LibreOffice Module vcl (master)  1
weld.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_VCL_WELD_HXX
11 #define INCLUDED_VCL_WELD_HXX
12 
14 #include <rtl/ustring.hxx>
15 #include <tools/color.hxx>
16 #include <tools/date.hxx>
17 #include <tools/fldunit.hxx>
18 #include <tools/gen.hxx>
19 #include <tools/link.hxx>
20 #include <vcl/dllapi.h>
21 #include <vcl/vclenum.hxx>
22 #include <vcl/font.hxx>
23 #include <vcl/vclptr.hxx>
24 #include <vcl/uitest/factory.hxx>
25 
26 #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
27 #include <com/sun/star/accessibility/XAccessible.hpp>
28 
29 #include <assert.h>
30 #include <memory>
31 #include <vector>
32 
33 namespace com::sun::star::awt
34 {
35 class XWindow;
36 }
38 {
39 class XDropTarget;
40 }
42 {
43 class XGraphic;
44 }
45 typedef css::uno::Reference<css::accessibility::XAccessible> a11yref;
46 typedef css::uno::Reference<css::accessibility::XAccessibleRelationSet> a11yrelationset;
47 enum class PointerStyle;
48 class CommandEvent;
49 class Formatter;
50 class InputContext;
51 class KeyEvent;
52 class MouseEvent;
53 class SvNumberFormatter;
55 class OutputDevice;
56 class VirtualDevice;
57 struct SystemEnvData;
58 
59 namespace vcl
60 {
61 class ILibreOfficeKitNotifier;
63 }
64 namespace tools
65 {
66 class JsonWriter;
67 }
68 
69 class LOKTrigger;
70 
71 namespace weld
72 {
73 class Container;
74 class DialogController;
75 
77 {
78 protected:
88 
89 public:
90  virtual void set_sensitive(bool sensitive) = 0;
91  virtual bool get_sensitive() const = 0;
92 
93  /* visibility */
94 
95  virtual void show() = 0;
96  virtual void hide() = 0;
97 
98  // This function simply calls show() or hide() but is convenient when the
99  // visibility depends on some condition
100  virtual void set_visible(bool visible)
101  {
102  if (visible)
103  show();
104  else
105  hide();
106  }
107 
108  // return if this widget's visibility is true
109  virtual bool get_visible() const = 0;
110 
111  // return if this widget's visibility and that of all its parents is true
112  virtual bool is_visible() const = 0;
113 
114  /* focus */
115 
116  // sets if this widget can own the keyboard focus
117  virtual void set_can_focus(bool bCanFocus) = 0;
118 
119  // causes this widget to have the keyboard focus
120  virtual void grab_focus() = 0;
121 
122  // returns if this widget has the keyboard focus
123  virtual bool has_focus() const = 0;
124 
125  // if the widget that has focus is a child, which includes toplevel popup
126  // children, of this widget. So an Entry with an active popup (or dialog)
127  // has has_child_focus of true, but has_focus of false, while its popup is
128  // shown
129  virtual bool has_child_focus() const = 0;
130 
131  // return if this widget has the keyboard focus within the active window
132  // TODO: review if this has any practical difference from has_focus()
133  virtual bool is_active() const = 0;
134 
135  virtual void set_has_default(bool has_default) = 0;
136  virtual bool get_has_default() const = 0;
137 
138  /* size */
139  virtual void set_size_request(int nWidth, int nHeight) = 0;
140  virtual Size get_size_request() const = 0;
141  virtual Size get_preferred_size() const = 0;
142 
143  /* measure */
144  virtual float get_approximate_digit_width() const = 0;
145  virtual int get_text_height() const = 0;
146  virtual Size get_pixel_size(const OUString& rText) const = 0;
147 
148  // The name of the widget in the GtkBuilder UI definition used to construct it.
149  virtual OString get_buildable_name() const = 0;
150  /*
151  Typically there is no need to change the buildable name at runtime, changing
152  the id in .ui file itself is preferred.
153 
154  But for ui-testing purposes it can sometimes be useful to rename
155  different widgets, that were loaded from the same .ui, to unique names
156  in order to distinguish between them
157  */
158  virtual void set_buildable_name(const OString& rName) = 0;
159 
160  /*
161  The help id of the widget used to identify help for this widget.
162 
163  By default the help id of a widget is a path-like sequence of (load-time)
164  buildable-names from the widgets UI definition ancestor to this widget,
165  e.g. grandparent/parent/widget.
166 
167  The default can be overwritten with set_help_id
168  */
169  virtual OString get_help_id() const = 0;
170  virtual void set_help_id(const OString& rName) = 0;
171 
172  virtual void set_grid_left_attach(int nAttach) = 0;
173  virtual int get_grid_left_attach() const = 0;
174  virtual void set_grid_width(int nCols) = 0;
175  virtual void set_grid_top_attach(int nAttach) = 0;
176  virtual int get_grid_top_attach() const = 0;
177 
178  virtual void set_hexpand(bool bExpand) = 0;
179  virtual bool get_hexpand() const = 0;
180  virtual void set_vexpand(bool bExpand) = 0;
181  virtual bool get_vexpand() const = 0;
182 
183  virtual void set_secondary(bool bSecondary) = 0;
184 
185  virtual void set_margin_top(int nMargin) = 0;
186  virtual void set_margin_bottom(int nMargin) = 0;
187  virtual void set_margin_start(int nMargin) = 0;
188  virtual void set_margin_end(int nMargin) = 0;
189 
190  virtual int get_margin_top() const = 0;
191  virtual int get_margin_bottom() const = 0;
192  virtual int get_margin_start() const = 0;
193  virtual int get_margin_end() const = 0;
194 
195  /*
196  * Report the extents of this widget relative to the rRelative target widget.
197  *
198  * To succeed, both widgets must be realized, and must share a common toplevel.
199  *
200  * returns false if the relative extents could not be determined, e.g. if
201  * either widget was not realized, or there was no common ancestor.
202  * Otherwise true.
203  */
204  virtual bool get_extents_relative_to(const Widget& rRelative, int& x, int& y, int& width,
205  int& height) const = 0;
206 
207  virtual void set_accessible_name(const OUString& rName) = 0;
208  virtual void set_accessible_description(const OUString& rDescription) = 0;
209  virtual OUString get_accessible_name() const = 0;
210 
211  virtual OUString get_accessible_description() const = 0;
212 
213  virtual void set_accessible_relation_labeled_by(weld::Widget* pLabel) = 0;
214  virtual void set_accessible_relation_label_for(weld::Widget* pLabeled) = 0;
215 
216  virtual void set_tooltip_text(const OUString& rTip) = 0;
217  virtual OUString get_tooltip_text() const = 0;
218 
219  virtual void connect_focus_in(const Link<Widget&, void>& rLink)
220  {
221  assert(!m_aFocusInHdl.IsSet() || !rLink.IsSet());
222  m_aFocusInHdl = rLink;
223  }
224 
225  virtual void connect_focus_out(const Link<Widget&, void>& rLink)
226  {
227  assert(!m_aFocusOutHdl.IsSet() || !rLink.IsSet());
228  m_aFocusOutHdl = rLink;
229  }
230 
231  // rLink is called when the mnemonic for the Widget is called.
232  // If rLink returns true the Widget will not automatically gain
233  // focus as normally occurs
235  {
236  assert(!m_aMnemonicActivateHdl.IsSet() || !rLink.IsSet());
237  m_aMnemonicActivateHdl = rLink;
238  }
239 
241  {
242  assert(!m_aSizeAllocateHdl.IsSet() || !rLink.IsSet());
243  m_aSizeAllocateHdl = rLink;
244  }
245 
247  {
248  assert(!m_aKeyPressHdl.IsSet() || !rLink.IsSet());
249  m_aKeyPressHdl = rLink;
250  }
251 
253  {
254  assert(!m_aKeyReleaseHdl.IsSet() || !rLink.IsSet());
255  m_aKeyReleaseHdl = rLink;
256  }
257 
259  {
260  assert(!m_aMousePressHdl.IsSet() || !rLink.IsSet());
261  m_aMousePressHdl = rLink;
262  }
263 
265  {
266  assert(!m_aMouseMotionHdl.IsSet() || !rLink.IsSet());
267  m_aMouseMotionHdl = rLink;
268  }
269 
271  {
272  assert(!m_aMouseReleaseHdl.IsSet() || !rLink.IsSet());
273  m_aMouseReleaseHdl = rLink;
274  }
275 
276  virtual void grab_add() = 0;
277  virtual bool has_grab() const = 0;
278  virtual void grab_remove() = 0;
279 
280  // font size is in points, not pixels, e.g. see Window::[G]etPointFont
281  virtual vcl::Font get_font() = 0;
282 
283  //true for rtl, false otherwise
284  virtual bool get_direction() const = 0;
285  virtual void set_direction(bool bRTL) = 0;
286 
287  virtual void freeze() = 0;
288  virtual void thaw() = 0;
289 
290  virtual std::unique_ptr<Container> weld_parent() const = 0;
291 
292  //iterate upwards through the hierarchy starting at this widgets parent,
293  //calling func with their helpid until func returns true or we run out of
294  //parents
295  virtual void help_hierarchy_foreach(const std::function<bool(const OString&)>& func) = 0;
296 
297  virtual OUString strip_mnemonic(const OUString& rLabel) const = 0;
298 
299  virtual VclPtr<VirtualDevice> create_virtual_device() const = 0;
300 
301  //make this widget look like a page in a notebook
302  virtual void set_stack_background() = 0;
303  //make this widget look like it has a highlighted background
304  virtual void set_highlight_background() = 0;
305  //make this widget suitable as parent for a title
306  virtual void set_title_background() = 0;
307  //make this widget suitable for use in a toolbar
308  virtual void set_toolbar_background() = 0;
309  //trying to use a custom color for a background is generally a bad idea. If your need
310  //fits one of the above categories then that's a somewhat better choice
311  virtual void set_background(const Color& rBackColor) = 0;
312 
313  virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() = 0;
314 
315  virtual void connect_get_property_tree(const Link<tools::JsonWriter&, void>& rLink) = 0;
316 
317  // render the widget to an output device
318  virtual void draw(OutputDevice& rOutput, const tools::Rectangle& rRect) = 0;
319 
320  virtual ~Widget() {}
321 };
322 
323 class VCL_DLLPUBLIC Container : virtual public Widget
324 {
325 public:
326  // remove and add in one go
327  virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) = 0;
328  // recursively unset has-default on any buttons in the widget hierarchy
329  virtual void recursively_unset_default_buttons() = 0;
330  // create an XWindow as a child of this container. The XWindow is
331  // suitable to contain css::awt::XControl items
332  virtual css::uno::Reference<css::awt::XWindow> CreateChildFrame() = 0;
333 };
334 
335 class VCL_DLLPUBLIC Box : virtual public Container
336 {
337 public:
338  // Moves child to a new position in the list of children
339  virtual void reorder_child(weld::Widget* pWidget, int position) = 0;
340  // Sort ok/cancel etc buttons in platform order
341  virtual void sort_native_button_order() = 0;
342 };
343 
344 class VCL_DLLPUBLIC Paned : virtual public Container
345 {
346 public:
347  // set pixel position of divider
348  virtual void set_position(int nPos) = 0;
349  // get pixel position of divider
350  virtual int get_position() const = 0;
351 };
352 
353 class VCL_DLLPUBLIC ScrolledWindow : virtual public Container
354 {
355 protected:
358 
359  void signal_vadjustment_changed() { m_aVChangeHdl.Call(*this); }
360  void signal_hadjustment_changed() { m_aHChangeHdl.Call(*this); }
361 
362 public:
363  virtual void hadjustment_configure(int value, int lower, int upper, int step_increment,
364  int page_increment, int page_size)
365  = 0;
366  virtual int hadjustment_get_value() const = 0;
367  virtual void hadjustment_set_value(int value) = 0;
368  virtual int hadjustment_get_upper() const = 0;
369  virtual void hadjustment_set_upper(int upper) = 0;
370  virtual int hadjustment_get_page_size() const = 0;
371  virtual void hadjustment_set_page_size(int size) = 0;
372  virtual void hadjustment_set_page_increment(int size) = 0;
373  virtual void hadjustment_set_step_increment(int size) = 0;
374  virtual void set_hpolicy(VclPolicyType eHPolicy) = 0;
375  virtual VclPolicyType get_hpolicy() const = 0;
377  {
378  m_aHChangeHdl = rLink;
379  }
380  virtual int get_hscroll_height() const = 0;
381 
382  virtual void vadjustment_configure(int value, int lower, int upper, int step_increment,
383  int page_increment, int page_size)
384  = 0;
385  virtual int vadjustment_get_value() const = 0;
386  virtual void vadjustment_set_value(int value) = 0;
387  virtual int vadjustment_get_upper() const = 0;
388  virtual void vadjustment_set_upper(int upper) = 0;
389  virtual int vadjustment_get_page_size() const = 0;
390  virtual void vadjustment_set_page_size(int size) = 0;
391  virtual void vadjustment_set_page_increment(int size) = 0;
392  virtual void vadjustment_set_step_increment(int size) = 0;
393  virtual int vadjustment_get_lower() const = 0;
394  virtual void vadjustment_set_lower(int upper) = 0;
395  virtual void set_vpolicy(VclPolicyType eVPolicy) = 0;
396  virtual VclPolicyType get_vpolicy() const = 0;
398  {
399  m_aVChangeHdl = rLink;
400  }
401  virtual int get_vscroll_width() const = 0;
402 };
403 
404 class Label;
405 
406 class VCL_DLLPUBLIC Frame : virtual public Container
407 {
408 public:
409  virtual void set_label(const OUString& rText) = 0;
410  virtual OUString get_label() const = 0;
411  virtual std::unique_ptr<Label> weld_label_widget() const = 0;
412 };
413 
414 class VCL_DLLPUBLIC Notebook : virtual public Container
415 {
416 protected:
419 
420 public:
421  virtual int get_current_page() const = 0;
422  virtual int get_page_index(const OString& rIdent) const = 0;
423  virtual OString get_page_ident(int nPage) const = 0;
424  virtual OString get_current_page_ident() const = 0;
425  virtual void set_current_page(int nPage) = 0;
426  virtual void set_current_page(const OString& rIdent) = 0;
427  virtual void remove_page(const OString& rIdent) = 0;
428  virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) = 0;
429  void append_page(const OString& rIdent, const OUString& rLabel)
430  {
431  insert_page(rIdent, rLabel, -1);
432  }
433  virtual void set_tab_label_text(const OString& rIdent, const OUString& rLabel) = 0;
434  virtual OUString get_tab_label_text(const OString& rIdent) const = 0;
435  virtual int get_n_pages() const = 0;
436  virtual weld::Container* get_page(const OString& rIdent) const = 0;
437 
438  void connect_leave_page(const Link<const OString&, bool>& rLink) { m_aLeavePageHdl = rLink; }
439 
440  void connect_enter_page(const Link<const OString&, void>& rLink) { m_aEnterPageHdl = rLink; }
441 };
442 
444 {
445 public:
446  ScreenShotEntry(const OString& rHelpId, const basegfx::B2IRange& rB2IRange)
447  : msHelpId(rHelpId)
448  , maB2IRange(rB2IRange)
449  {
450  }
451 
452  const basegfx::B2IRange& getB2IRange() const { return maB2IRange; }
453 
454  const OString& GetHelpId() const { return msHelpId; }
455 
456 private:
457  OString msHelpId;
459 };
460 
461 typedef std::vector<ScreenShotEntry> ScreenShotCollection;
462 
463 class VCL_DLLPUBLIC Window : virtual public Container
464 {
465 protected:
468 
469  void signal_toplevel_focus_changed() { m_aTopLevelFocusChangedHdl.Call(*this); }
470 
471 public:
472  virtual void set_title(const OUString& rTitle) = 0;
473  virtual OUString get_title() const = 0;
474  virtual void set_busy_cursor(bool bBusy) = 0;
475  virtual void window_move(int x, int y) = 0;
476  virtual void set_modal(bool bModal) = 0;
477  virtual bool get_modal() const = 0;
478  virtual bool get_resizable() const = 0;
479  virtual Size get_size() const = 0;
480  virtual Point get_position() const = 0;
481  virtual tools::Rectangle get_monitor_workarea() const = 0;
482  // center window on is parent
483  //
484  // bTrackGeometryRequests set to true tries to ensure the window will end
485  // up still centered on its parent windows final size, taking into account
486  // that there may currently be pending geometry requests for the parent not
487  // yet processed by the underlying toolkit
488  //
489  // for e.g gtk this will means the window is always centered even when
490  // resized, calling set_centered_on_parent with false will turn this
491  // off again.
492  virtual void set_centered_on_parent(bool bTrackGeometryRequests) = 0;
493  // returns whether the widget that has focus is within this Window
494  virtual bool has_toplevel_focus() const = 0;
495  virtual void present() = 0;
496  virtual void set_window_state(const OString& rStr) = 0;
497  virtual OString get_window_state(WindowStateMask nMask) const = 0;
498 
499  virtual css::uno::Reference<css::awt::XWindow> GetXWindow() = 0;
500 
501  void connect_help(const Link<Widget&, bool>& rLink) { m_aHelpRequestHdl = rLink; }
503  {
504  m_aTopLevelFocusChangedHdl = rLink;
505  }
506 
507  virtual SystemEnvData get_system_data() const = 0;
508 
509  virtual void resize_to_request() = 0;
510 
511  // collect positions of widgets and their help ids for screenshot purposes
512  virtual ScreenShotCollection collect_screenshot_data() = 0;
513 
514  // render the widget to an output device
515  virtual VclPtr<VirtualDevice> screenshot() = 0;
516 };
517 
519 {
520 private:
522 
523 public:
525  : m_pWindow(pWindow)
526  {
527  if (m_pWindow)
528  m_pWindow->set_busy_cursor(true);
529  }
531  {
532  if (m_pWindow)
533  m_pWindow->set_busy_cursor(false);
534  }
535 };
536 
537 class Button;
538 
539 class VCL_DLLPUBLIC Dialog : virtual public Window
540 {
541 private:
543  virtual bool runAsync(std::shared_ptr<DialogController>,
544  const std::function<void(sal_Int32)>& func)
545  = 0;
546 
547 public:
548  virtual int run() = 0;
549  // Run async without a controller
550  // @param self - must point to this, to enforce that the dialog was created/held by a shared_ptr
551  virtual bool runAsync(std::shared_ptr<Dialog> const& rxSelf,
552  const std::function<void(sal_Int32)>& func)
553  = 0;
554  virtual void response(int response) = 0;
555  virtual void add_button(const OUString& rText, int response, const OString& rHelpId = OString())
556  = 0;
557  virtual void set_default_response(int response) = 0;
558  virtual Button* weld_widget_for_response(int response) = 0;
559  virtual Container* weld_content_area() = 0;
560 
561  // shrink the dialog down to shown just these widgets
562  virtual void collapse(weld::Widget* pEdit, weld::Widget* pButton) = 0;
563  // undo previous dialog collapse
564  virtual void undo_collapse() = 0;
565 
566  virtual void SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink)
567  = 0;
568 };
569 
570 class VCL_DLLPUBLIC MessageDialog : virtual public Dialog
571 {
572 public:
573  virtual void set_primary_text(const OUString& rText) = 0;
574  virtual OUString get_primary_text() const = 0;
575  virtual void set_secondary_text(const OUString& rText) = 0;
576  virtual OUString get_secondary_text() const = 0;
577  virtual Container* weld_message_area() = 0;
578 };
579 
580 class VCL_DLLPUBLIC Assistant : virtual public Dialog
581 {
582 protected:
584 
585  bool signal_jump_page(const OString& rIdent) { return m_aJumpPageHdl.Call(rIdent); }
586 
587 public:
588  virtual int get_current_page() const = 0;
589  virtual int get_n_pages() const = 0;
590  virtual OString get_page_ident(int nPage) const = 0;
591  virtual OString get_current_page_ident() const = 0;
592  virtual void set_current_page(int nPage) = 0;
593  virtual void set_current_page(const OString& rIdent) = 0;
594  // move the page rIdent to position nIndex
595  virtual void set_page_index(const OString& rIdent, int nIndex) = 0;
596  virtual void set_page_title(const OString& rIdent, const OUString& rTitle) = 0;
597  virtual OUString get_page_title(const OString& rIdent) const = 0;
598  virtual void set_page_sensitive(const OString& rIdent, bool bSensitive) = 0;
599  virtual weld::Container* append_page(const OString& rIdent) = 0;
600 
601  virtual void set_page_side_help_id(const OString& rHelpId) = 0;
602 
603  void connect_jump_page(const Link<const OString&, bool>& rLink) { m_aJumpPageHdl = rLink; }
604 };
605 
607 {
608  OUString sString;
609  OUString sId;
610  OUString sImage;
611  ComboBoxEntry(const OUString& rString)
612  : sString(rString)
613  {
614  }
615  ComboBoxEntry(const OUString& rString, const OUString& rId)
616  : sString(rString)
617  , sId(rId)
618  {
619  }
620  ComboBoxEntry(const OUString& rString, const OUString& rId, const OUString& rImage)
621  : sString(rString)
622  , sId(rId)
623  , sImage(rImage)
624  {
625  }
626 };
627 
629 {
630  Normal,
631  Warning,
632  Error,
633 };
634 
635 class Menu;
636 
638 class VCL_DLLPUBLIC ComboBox : virtual public Container
639 {
640 private:
641  OUString m_sSavedValue;
642 
643 public:
644  // OUString is the id of the row, it may be null to measure the height of a generic line
645  typedef std::tuple<vcl::RenderContext&, const tools::Rectangle&, bool, const OUString&>
647 
648 protected:
653 
654  friend class ::LOKTrigger;
655 
656  void signal_changed() { m_aChangeHdl.Call(*this); }
657 
658  virtual void signal_popup_toggled() { m_aPopupToggledHdl.Call(*this); }
659 
662  bool bSelected, const OUString& rId)
663  {
664  m_aRenderHdl.Call(render_args(rDevice, rRect, bSelected, rId));
665  }
666 
668  Size signal_custom_get_size(vcl::RenderContext& rDevice) { return m_aGetSizeHdl.Call(rDevice); }
669 
670 public:
671  virtual void insert(int pos, const OUString& rStr, const OUString* pId,
672  const OUString* pIconName, VirtualDevice* pImageSurface)
673  = 0;
674  virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems, bool bKeepExisting)
675  = 0;
676  void insert_text(int pos, const OUString& rStr)
677  {
678  insert(pos, rStr, nullptr, nullptr, nullptr);
679  }
680  void append_text(const OUString& rStr) { insert(-1, rStr, nullptr, nullptr, nullptr); }
681  void append(const OUString& rId, const OUString& rStr)
682  {
683  insert(-1, rStr, &rId, nullptr, nullptr);
684  }
685  void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
686  {
687  insert(-1, rStr, &rId, &rImage, nullptr);
688  }
689  void append(const OUString& rId, const OUString& rStr, VirtualDevice& rImage)
690  {
691  insert(-1, rStr, &rId, nullptr, &rImage);
692  }
693  virtual void insert_separator(int pos, const OUString& rId) = 0;
694  void append_separator(const OUString& rId) { insert_separator(-1, rId); }
695 
696  virtual int get_count() const = 0;
697  virtual void make_sorted() = 0;
698  virtual void clear() = 0;
699 
700  //by index
701  virtual int get_active() const = 0;
702  virtual void set_active(int pos) = 0;
703  virtual void remove(int pos) = 0;
704 
705  //by text
706  virtual OUString get_active_text() const = 0;
707  void set_active_text(const OUString& rStr) { set_active(find_text(rStr)); }
708  virtual OUString get_text(int pos) const = 0;
709  virtual int find_text(const OUString& rStr) const = 0;
710  void remove_text(const OUString& rText) { remove(find_text(rText)); }
711 
712  //by id
713  virtual OUString get_active_id() const = 0;
714  virtual void set_active_id(const OUString& rStr) = 0;
715  virtual OUString get_id(int pos) const = 0;
716  virtual void set_id(int row, const OUString& rId) = 0;
717  virtual int find_id(const OUString& rId) const = 0;
718  void remove_id(const OUString& rId) { remove(find_id(rId)); }
719 
720  /* m_aChangeHdl is called when the active item is changed. The can be due
721  to the user selecting a different item from the list or while typing
722  into the entry of a combo box with an entry.
723 
724  Use changed_by_direct_pick() to discover whether an item was actually explicitly
725  selected, e.g. from the menu.
726  */
727  void connect_changed(const Link<ComboBox&, void>& rLink) { m_aChangeHdl = rLink; }
728 
729  virtual bool changed_by_direct_pick() const = 0;
730 
731  virtual void connect_popup_toggled(const Link<ComboBox&, void>& rLink)
732  {
733  m_aPopupToggledHdl = rLink;
734  }
735 
736  //entry related
737  virtual bool has_entry() const = 0;
738  virtual void set_entry_message_type(EntryMessageType eType) = 0;
739  virtual void set_entry_text(const OUString& rStr) = 0;
740  virtual void set_entry_width_chars(int nChars) = 0;
741  virtual void set_entry_max_length(int nChars) = 0;
742  virtual void select_entry_region(int nStartPos, int nEndPos) = 0;
743  virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) = 0;
744  virtual void set_entry_completion(bool bEnable, bool bCaseSensitive = false) = 0;
745  virtual void set_entry_placeholder_text(const OUString& rText) = 0;
746  virtual void set_entry_editable(bool bEditable) = 0;
747  virtual void cut_entry_clipboard() = 0;
748  virtual void copy_entry_clipboard() = 0;
749  virtual void paste_entry_clipboard() = 0;
750 
751  // font size is in points, not pixels, e.g. see Window::[G]etPointFont
752  virtual void set_entry_font(const vcl::Font& rFont) = 0;
753  virtual vcl::Font get_entry_font() = 0;
754 
755  virtual bool get_popup_shown() const = 0;
756 
758  {
759  m_aEntryInsertTextHdl = rLink;
760  }
761 
762  // callback returns true to indicated no further processing of activate wanted
763  void connect_entry_activate(const Link<ComboBox&, bool>& rLink) { m_aEntryActivateHdl = rLink; }
764 
765  void save_value() { m_sSavedValue = get_active_text(); }
766  OUString const& get_saved_value() const { return m_sSavedValue; }
767  bool get_value_changed_from_saved() const { return m_sSavedValue != get_active_text(); }
768 
769  // for custom rendering a row
771  {
772  m_aGetSizeHdl = rLink;
773  }
774  void connect_custom_render(const Link<render_args, void>& rLink) { m_aRenderHdl = rLink; }
775  // call set_custom_renderer after setting custom callbacks
776  virtual void set_custom_renderer(bool bOn) = 0;
777  // create a virtual device compatible with the device passed in render_args wrt alpha
778  virtual VclPtr<VirtualDevice> create_render_virtual_device() const = 0;
779  // set a sub menu for a entry, only works with custom rendering
780  virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) = 0;
781  // get the width needed to show the menu launcher in a custom row
782  virtual int get_menu_button_width() const = 0;
783 
784  // for mru support
785  virtual int get_max_mru_count() const = 0;
786  virtual void set_max_mru_count(int nCount) = 0;
787  virtual OUString get_mru_entries() const = 0;
788  virtual void set_mru_entries(const OUString& rEntries) = 0;
789 };
790 
792 {
793  Check,
794  Radio
795 };
796 
798 {
799 private:
800  TreeIter(const TreeIter&) = delete;
801  TreeIter& operator=(const TreeIter&) = delete;
802 
803 public:
804  TreeIter() {}
805  virtual bool equal(const TreeIter& rOther) const = 0;
806  virtual ~TreeIter() {}
807 };
808 
809 /* Model column indexes are considered to begin at 0, but with special columns
810  before index 0. A expander image column (and an additional optional toggle
811  button column when enable_toggle_buttons is used). Column index -1 is
812  reserved to access those columns.
813 */
814 class VCL_DLLPUBLIC TreeView : virtual public Container
815 {
816  friend class ::LOKTrigger;
817 
818 public:
819  typedef std::pair<const TreeIter&, int> iter_col;
820  typedef std::pair<const TreeIter&, OUString> iter_string;
821  // OUString is the id of the row, it may be null to measure the height of a generic line
822  typedef std::pair<vcl::RenderContext&, const OUString&> get_size_args;
823  typedef std::tuple<vcl::RenderContext&, const tools::Rectangle&, bool, const OUString&>
825 
826 private:
827  OUString m_sSavedValue;
828 
829 protected:
836  // if handler returns false, the expansion of the row is refused
838  // if handler returns false, the collapse of the row is refused
842  // if handler returns true, then menu has been show and event is consumed
844  // if handler returns true, drag is disallowed, consumer can change bool
845  // arg to false to disable the treeview default dnd icon
847  std::function<int(const weld::TreeIter&, const weld::TreeIter&)> m_aCustomSort;
848 
849 protected:
850  void signal_changed() { m_aChangeHdl.Call(*this); }
851  bool signal_row_activated() { return m_aRowActivatedHdl.Call(*this); }
852  void signal_column_clicked(int nColumn) { m_aColumnClickedHdl.Call(nColumn); }
853  bool signal_expanding(const TreeIter& rIter)
854  {
855  return !m_aExpandingHdl.IsSet() || m_aExpandingHdl.Call(rIter);
856  }
857  bool signal_collapsing(const TreeIter& rIter)
858  {
859  return !m_aCollapsingHdl.IsSet() || m_aCollapsingHdl.Call(rIter);
860  }
861  void signal_visible_range_changed() { m_aVisibleRangeChangedHdl.Call(*this); }
862  void signal_model_changed() { m_aModelChangedHdl.Call(*this); }
863 
864  void signal_toggled(const iter_col& rIterCol) { m_aRadioToggleHdl.Call(rIterCol); }
865 
866  bool signal_editing_started(const TreeIter& rIter) { return m_aEditingStartedHdl.Call(rIter); }
867 
868  bool signal_editing_done(const iter_string& rIterText)
869  {
870  return m_aEditingDoneHdl.Call(rIterText);
871  }
872 
874  OUString signal_query_tooltip(const TreeIter& rIter) { return m_aQueryTooltipHdl.Call(rIter); }
875 
878  bool bSelected, const OUString& rId)
879  {
880  m_aRenderHdl.Call(render_args(rDevice, rRect, bSelected, rId));
881  }
882 
884  Size signal_custom_get_size(vcl::RenderContext& rDevice, const OUString& rId)
885  {
886  return m_aGetSizeHdl.Call(get_size_args(rDevice, rId));
887  }
888 
889 public:
891  {
892  assert(!m_aQueryTooltipHdl.IsSet() || !rLink.IsSet());
893  m_aQueryTooltipHdl = rLink;
894  }
895 
896  virtual void insert(const TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
897  const OUString* pIconName, VirtualDevice* pImageSurface,
898  bool bChildrenOnDemand, TreeIter* pRet)
899  = 0;
900 
901  void insert(int nRow, TreeIter* pRet = nullptr)
902  {
903  insert(nullptr, nRow, nullptr, nullptr, nullptr, nullptr, false, pRet);
904  }
905 
906  void append(TreeIter* pRet = nullptr) { insert(-1, pRet); }
907 
908  void insert(int pos, const OUString& rStr, const OUString* pId, const OUString* pIconName,
909  VirtualDevice* pImageSurface)
910  {
911  insert(nullptr, pos, &rStr, pId, pIconName, pImageSurface, false, nullptr);
912  }
913  void insert_text(int pos, const OUString& rStr)
914  {
915  insert(nullptr, pos, &rStr, nullptr, nullptr, nullptr, false, nullptr);
916  }
917  void append_text(const OUString& rStr)
918  {
919  insert(nullptr, -1, &rStr, nullptr, nullptr, nullptr, false, nullptr);
920  }
921  void append(const OUString& rId, const OUString& rStr)
922  {
923  insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, false, nullptr);
924  }
925  void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
926  {
927  insert(nullptr, -1, &rStr, &rId, &rImage, nullptr, false, nullptr);
928  }
929  void append(const TreeIter* pParent, const OUString& rStr)
930  {
931  insert(pParent, -1, &rStr, nullptr, nullptr, nullptr, false, nullptr);
932  }
933 
934  virtual void insert_separator(int pos, const OUString& rId) = 0;
935  void append_separator(const OUString& rId) { insert_separator(-1, rId); }
936 
937  void connect_changed(const Link<TreeView&, void>& rLink) { m_aChangeHdl = rLink; }
938 
939  /* A row is "activated" when the user double clicks a treeview row. It may
940  also be emitted when a row is selected and Space or Enter is pressed.
941 
942  a return of "true" means the activation has been handled, a "false" propagates
943  the activation to the default handler which expands/collapses the row, if possible.
944  */
945  void connect_row_activated(const Link<TreeView&, bool>& rLink) { m_aRowActivatedHdl = rLink; }
946 
947  // Argument is a pair of iter, col describing the toggled node
948  void connect_toggled(const Link<const iter_col&, void>& rLink) { m_aRadioToggleHdl = rLink; }
949 
950  void connect_column_clicked(const Link<int, void>& rLink) { m_aColumnClickedHdl = rLink; }
951  void connect_model_changed(const Link<TreeView&, void>& rLink) { m_aModelChangedHdl = rLink; }
952 
953  virtual OUString get_selected_text() const = 0;
954  virtual OUString get_selected_id() const = 0;
955 
956  // call before inserting any content and connecting to toggle signals,
957  // an pre-inserted checkbutton column will exist at the start of every row
958  // inserted after this call which can be accessed with col index -1
959  virtual void enable_toggle_buttons(ColumnToggleType eType) = 0;
960 
961  virtual void set_clicks_to_toggle(int nToggleBehavior) = 0;
962 
963  //by index
964  virtual int get_selected_index() const = 0;
965  //Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
966  virtual void select(int pos) = 0;
967  virtual void unselect(int pos) = 0;
968  virtual void remove(int pos) = 0;
969  // col index -1 gets the first text column
970  virtual OUString get_text(int row, int col = -1) const = 0;
971  // col index -1 sets the first text column
972  virtual void set_text(int row, const OUString& rText, int col = -1) = 0;
973  // col index -1 sets the first text column
974  virtual void set_sensitive(int row, bool bSensitive, int col = -1) = 0;
975  virtual void set_id(int row, const OUString& rId) = 0;
976  // col index -1 sets the expander toggle, enable_toggle_buttons must have been called to create that column
977  virtual void set_toggle(int row, TriState eState, int col = -1) = 0;
978  // col index -1 gets the expander toggle, enable_toggle_buttons must have been called to create that column
979  virtual TriState get_toggle(int row, int col = -1) const = 0;
980  // col index -1 sets the expander image
981  virtual void set_image(int row, const OUString& rImage, int col = -1) = 0;
982  // col index -1 sets the expander image
983  virtual void set_image(int row, VirtualDevice& rImage, int col = -1) = 0;
984  // col index -1 sets the expander image
985  virtual void set_image(int row, const css::uno::Reference<css::graphic::XGraphic>& rImage,
986  int col = -1)
987  = 0;
988  virtual void set_text_emphasis(int row, bool bOn, int col) = 0;
989  virtual bool get_text_emphasis(int row, int col) const = 0;
990  virtual void set_text_align(int row, double fAlign, int col) = 0;
991  virtual void swap(int pos1, int pos2) = 0;
992  virtual std::vector<int> get_selected_rows() const = 0;
993  virtual void set_font_color(int pos, const Color& rColor) = 0;
994  // scroll to make 'row' visible, this will also expand all parent rows of 'row' as necessary to
995  // make 'row' visible
996  virtual void scroll_to_row(int row) = 0;
997  virtual bool is_selected(int pos) const = 0;
998  virtual int get_cursor_index() const = 0;
999  virtual void set_cursor(int pos) = 0;
1000 
1001  //by text
1002  virtual int find_text(const OUString& rText) const = 0;
1003  //Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1004  void select_text(const OUString& rText) { select(find_text(rText)); }
1005  void remove_text(const OUString& rText) { remove(find_text(rText)); }
1006  std::vector<OUString> get_selected_rows_text() const
1007  {
1008  std::vector<int> aRows(get_selected_rows());
1009  std::vector<OUString> aRet;
1010  aRet.reserve(aRows.size());
1011  for (auto a : aRows)
1012  aRet.push_back(get_text(a));
1013  return aRet;
1014  }
1015 
1016  //by id
1017  virtual OUString get_id(int pos) const = 0;
1018  virtual int find_id(const OUString& rId) const = 0;
1019  //Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1020  void select_id(const OUString& rId) { select(find_id(rId)); }
1021  void remove_id(const OUString& rText) { remove(find_id(rText)); }
1022 
1023  //via iter
1024  virtual std::unique_ptr<TreeIter> make_iterator(const TreeIter* pOrig = nullptr) const = 0;
1025  virtual void copy_iterator(const TreeIter& rSource, TreeIter& rDest) const = 0;
1026  virtual bool get_selected(TreeIter* pIter) const = 0;
1027  virtual bool get_cursor(TreeIter* pIter) const = 0;
1028  virtual void set_cursor(const TreeIter& rIter) = 0;
1029  virtual bool get_iter_first(TreeIter& rIter) const = 0;
1030  // set iter to point to next node at the current level
1031  virtual bool iter_next_sibling(TreeIter& rIter) const = 0;
1032  // set iter to point to previous node at the current level
1033  virtual bool iter_previous_sibling(TreeIter& rIter) const = 0;
1034  // set iter to point to next node, depth first, then sibling
1035  virtual bool iter_next(TreeIter& rIter) const = 0;
1036  // set iter to point to previous node, sibling first then depth
1037  virtual bool iter_previous(TreeIter& rIter) const = 0;
1038  // set iter to point to first child node
1039  virtual bool iter_children(TreeIter& rIter) const = 0;
1040  bool iter_nth_sibling(TreeIter& rIter, int nChild) const
1041  {
1042  bool bRet = true;
1043  for (int i = 0; i < nChild && bRet; ++i)
1044  bRet = iter_next_sibling(rIter);
1045  return bRet;
1046  }
1047  bool iter_nth_child(TreeIter& rIter, int nChild) const
1048  {
1049  if (!iter_children(rIter))
1050  return false;
1051  return iter_nth_sibling(rIter, nChild);
1052  }
1053  virtual bool iter_parent(TreeIter& rIter) const = 0;
1054  virtual int get_iter_depth(const TreeIter& rIter) const = 0;
1055  virtual int get_iter_index_in_parent(const TreeIter& rIter) const = 0;
1056  /* Compares two paths. If a appears before b in a tree, then -1 is returned.
1057  If b appears before a , then 1 is returned. If the two nodes are equal,
1058  then 0 is returned.
1059  */
1060  virtual int iter_compare(const TreeIter& a, const TreeIter& b) const = 0;
1061  virtual bool iter_has_child(const TreeIter& rIter) const = 0;
1062  // returns the number of direct children rIter has
1063  virtual int iter_n_children(const TreeIter& rIter) const = 0;
1064  virtual void remove(const TreeIter& rIter) = 0;
1065  //Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1066  virtual void select(const TreeIter& rIter) = 0;
1067  virtual void unselect(const TreeIter& rIter) = 0;
1068  virtual bool get_row_expanded(const TreeIter& rIter) const = 0;
1069  virtual bool get_children_on_demand(const TreeIter& rIter) const = 0;
1070  virtual void set_children_on_demand(const TreeIter& rIter, bool bChildrenOnDemand) = 0;
1071  //visually indent this row as if it was at get_iter_depth() + nIndentLevel
1072  virtual void set_extra_row_indent(const TreeIter& rIter, int nIndentLevel) = 0;
1073  virtual void expand_row(const TreeIter& rIter) = 0;
1074  virtual void collapse_row(const TreeIter& rIter) = 0;
1075  // col index -1 sets the first text column
1076  virtual void set_text(const TreeIter& rIter, const OUString& rStr, int col = -1) = 0;
1077  // col index -1 sets the first text column
1078  virtual void set_sensitive(const TreeIter& rIter, bool bSensitive, int col = -1) = 0;
1079  virtual void set_text_emphasis(const TreeIter& rIter, bool bOn, int col) = 0;
1080  virtual bool get_text_emphasis(const TreeIter& rIter, int col) const = 0;
1081  virtual void set_text_align(const TreeIter& rIter, double fAlign, int col) = 0;
1082  // col index -1 sets the expander toggle, enable_toggle_buttons must have been called to create that column
1083  virtual void set_toggle(const TreeIter& rIter, TriState bOn, int col = -1) = 0;
1084  // col index -1 gets the expander toggle, enable_toggle_buttons must have been called to create that column
1085  virtual TriState get_toggle(const TreeIter& rIter, int col = -1) const = 0;
1086  // col index -1 gets the first text column
1087  virtual OUString get_text(const TreeIter& rIter, int col = -1) const = 0;
1088  virtual void set_id(const TreeIter& rIter, const OUString& rId) = 0;
1089  virtual OUString get_id(const TreeIter& rIter) const = 0;
1090  // col index -1 sets the expander image
1091  virtual void set_image(const TreeIter& rIter, const OUString& rImage, int col = -1) = 0;
1092  // col index -1 sets the expander image
1093  virtual void set_image(const TreeIter& rIter, VirtualDevice& rImage, int col = -1) = 0;
1094  // col index -1 sets the expander image
1095  virtual void set_image(const TreeIter& rIter,
1096  const css::uno::Reference<css::graphic::XGraphic>& rImage, int col = -1)
1097  = 0;
1098  virtual void set_font_color(const TreeIter& rIter, const Color& rColor) = 0;
1099  // scroll to make rIter visible, this will also expand all parent rows of rIter as necessary to
1100  // make rIter visible
1101  virtual void scroll_to_row(const TreeIter& rIter) = 0;
1102  virtual bool is_selected(const TreeIter& rIter) const = 0;
1103 
1104  virtual void move_subtree(TreeIter& rNode, const TreeIter* pNewParent, int nIndexInNewParent)
1105  = 0;
1106 
1107  // call func on each element until func returns true or we run out of elements
1108  virtual void all_foreach(const std::function<bool(TreeIter&)>& func) = 0;
1109  // call func on each selected element until func returns true or we run out of elements
1110  virtual void selected_foreach(const std::function<bool(TreeIter&)>& func) = 0;
1111  // call func on each visible element until func returns true or we run out of elements
1112  virtual void visible_foreach(const std::function<bool(TreeIter&)>& func) = 0;
1113  // clear the tree, then add nSourceCount rows, call func on each row
1114  // inserted with an arg of the index that this row will be when bulk insert
1115  // ends.
1116  //
1117  // this enables inserting the entries backwards in models where that is faster,
1118  //
1119  // pFixedWidths is optional, when present each matching entry col text
1120  // width will not be measured, and the fixed width used instead. Use
1121  // sparingly because wider text than the fixed width is clipped and cannot
1122  // be scrolled into view horizontally.
1123  virtual void bulk_insert_for_each(int nSourceCount,
1124  const std::function<void(TreeIter&, int nSourceIndex)>& func,
1125  const std::vector<int>* pFixedWidths = nullptr)
1126  = 0;
1127 
1128  void connect_expanding(const Link<const TreeIter&, bool>& rLink) { m_aExpandingHdl = rLink; }
1129  void connect_collapsing(const Link<const TreeIter&, bool>& rLink) { m_aCollapsingHdl = rLink; }
1130 
1131  // rStartLink returns true to allow editing, false to disallow
1132  // rEndLink returns true to accept the edit, false to reject
1133  virtual void connect_editing(const Link<const TreeIter&, bool>& rStartLink,
1134  const Link<const iter_string&, bool>& rEndLink)
1135  {
1136  assert(rStartLink.IsSet() == rEndLink.IsSet() && "should be both on or both off");
1137  m_aEditingStartedHdl = rStartLink;
1138  m_aEditingDoneHdl = rEndLink;
1139  }
1140 
1141  virtual void start_editing(const weld::TreeIter& rEntry) = 0;
1142  virtual void end_editing() = 0;
1143 
1145  {
1146  assert(!m_aVisibleRangeChangedHdl.IsSet() || !rLink.IsSet());
1147  m_aVisibleRangeChangedHdl = rLink;
1148  }
1149 
1151  {
1152  m_aPopupMenuHdl = rLink;
1153  }
1154 
1155  virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rTransferrable,
1156  sal_uInt8 eDNDConstants)
1157  = 0;
1158 
1159  void connect_drag_begin(const Link<bool&, bool>& rLink) { m_aDragBeginHdl = rLink; }
1160 
1161  //all of them. Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1162  void select_all() { unselect(-1); }
1163  void unselect_all() { select(-1); }
1164 
1165  // return the number of toplevel nodes
1166  virtual int n_children() const = 0;
1167 
1168  // afterwards, entries will be in default ascending sort order
1169  virtual void make_sorted() = 0;
1170  virtual void make_unsorted() = 0;
1171  virtual bool get_sort_order() const = 0;
1172  virtual void set_sort_order(bool bAscending) = 0;
1173 
1174  // TRUE ascending, FALSE, descending, INDET, neither (off)
1175  virtual void set_sort_indicator(TriState eState, int nColumn) = 0;
1176  virtual TriState get_sort_indicator(int nColumn) const = 0;
1177 
1178  virtual int get_sort_column() const = 0;
1179  virtual void set_sort_column(int nColumn) = 0;
1180 
1181  virtual void
1182  set_sort_func(const std::function<int(const weld::TreeIter&, const weld::TreeIter&)>& func)
1183  {
1184  m_aCustomSort = func;
1185  }
1186 
1187  virtual void clear() = 0;
1188  virtual int get_height_rows(int nRows) const = 0;
1189 
1190  virtual void columns_autosize() = 0;
1191  virtual void set_column_fixed_widths(const std::vector<int>& rWidths) = 0;
1192  virtual void set_column_editables(const std::vector<bool>& rEditables) = 0;
1193  virtual int get_column_width(int nCol) const = 0;
1194  virtual void set_centered_column(int nCol) = 0;
1195  virtual OUString get_column_title(int nColumn) const = 0;
1196  virtual void set_column_title(int nColumn, const OUString& rTitle) = 0;
1197 
1198  int get_checkbox_column_width() const { return get_approximate_digit_width() * 3 + 6; }
1199 
1200  virtual void set_selection_mode(SelectionMode eMode) = 0;
1201  virtual int count_selected_rows() const = 0;
1202  // remove the selected nodes
1203  virtual void remove_selection() = 0;
1204 
1205  virtual void vadjustment_set_value(int value) = 0;
1206  virtual int vadjustment_get_value() const = 0;
1207 
1208  void save_value() { m_sSavedValue = get_selected_text(); }
1209  OUString const& get_saved_value() const { return m_sSavedValue; }
1210  bool get_value_changed_from_saved() const { return m_sSavedValue != get_selected_text(); }
1211 
1212  virtual void set_show_expanders(bool bShow) = 0;
1213 
1214  // for custom rendering a cell
1215  void connect_custom_get_size(const Link<get_size_args, Size>& rLink) { m_aGetSizeHdl = rLink; }
1216  void connect_custom_render(const Link<render_args, void>& rLink) { m_aRenderHdl = rLink; }
1217  // call set_column_custom_renderer after setting custom callbacks
1218  virtual void set_column_custom_renderer(int nColumn, bool bEnable) = 0;
1219  // redraw all rows, typically only useful with custom rendering to redraw due to external
1220  // state change
1221  virtual void queue_draw() = 0;
1222 
1223  /* with bDnDMode false simply return the row under the point
1224  *
1225  * with bDnDMode true:
1226  * a) return the row which should be dropped on, which may
1227  * be different from the row the mouse is over in some backends where
1228  * positioning the mouse on the bottom half of a row indicates to drop
1229  * after the row
1230  * b) dnd highlight the dest row
1231  */
1232  virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult, bool bDnDMode) = 0;
1233  virtual void unset_drag_dest_row() = 0;
1234  virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const = 0;
1235  // for dragging and dropping between TreeViews, return the active source
1236  virtual TreeView* get_drag_source() const = 0;
1237 
1238  using Widget::set_sensitive;
1239 };
1240 
1241 class VCL_DLLPUBLIC IconView : virtual public Container
1242 {
1243  friend class ::LOKTrigger;
1244 
1245 private:
1246  OUString m_sSavedValue;
1247 
1248 protected:
1251 
1252  void signal_selection_changed() { m_aSelectionChangeHdl.Call(*this); }
1253  bool signal_item_activated() { return m_aItemActivatedHdl.Call(*this); }
1254 
1255 public:
1256  virtual void insert(int pos, const OUString* pStr, const OUString* pId,
1257  const OUString* pIconName, TreeIter* pRet)
1258  = 0;
1259 
1260  virtual void insert(int pos, const OUString* pStr, const OUString* pId,
1261  const VirtualDevice* pIcon, TreeIter* pRet)
1262  = 0;
1263 
1264  void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
1265  {
1266  insert(-1, &rStr, &rId, &rImage, nullptr);
1267  }
1268 
1269  void append(const OUString& rId, const OUString& rStr, const VirtualDevice* pImage)
1270  {
1271  insert(-1, &rStr, &rId, pImage, nullptr);
1272  }
1273 
1275  {
1276  m_aSelectionChangeHdl = rLink;
1277  }
1278 
1279  /* A row is "activated" when the user double clicks a treeview row. It may
1280  also be emitted when a row is selected and Space or Enter is pressed.
1281 
1282  a return of "true" means the activation has been handled, a "false" propagates
1283  the activation to the default handler which expands/collapses the row, if possible.
1284  */
1285  void connect_item_activated(const Link<IconView&, bool>& rLink) { m_aItemActivatedHdl = rLink; }
1286 
1287  virtual OUString get_selected_id() const = 0;
1288 
1289  virtual void clear() = 0;
1290 
1291  virtual int count_selected_items() const = 0;
1292 
1293  virtual OUString get_selected_text() const = 0;
1294 
1295  //by index. Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1296  virtual void select(int pos) = 0;
1297  virtual void unselect(int pos) = 0;
1298 
1299  //via iter
1300  virtual std::unique_ptr<TreeIter> make_iterator(const TreeIter* pOrig = nullptr) const = 0;
1301  virtual bool get_selected(TreeIter* pIter) const = 0;
1302  virtual bool get_cursor(TreeIter* pIter) const = 0;
1303  virtual void set_cursor(const TreeIter& rIter) = 0;
1304  virtual bool get_iter_first(TreeIter& rIter) const = 0;
1305  virtual OUString get_id(const TreeIter& rIter) const = 0;
1306  virtual void scroll_to_item(const TreeIter& rIter) = 0;
1307 
1308  // call func on each selected element until func returns true or we run out of elements
1309  virtual void selected_foreach(const std::function<bool(TreeIter&)>& func) = 0;
1310 
1311  //all of them. Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1312  void select_all() { unselect(-1); }
1313  void unselect_all() { select(-1); }
1314 
1315  // return the number of toplevel nodes
1316  virtual int n_children() const = 0;
1317 
1318  void save_value() { m_sSavedValue = get_selected_text(); }
1319  OUString const& get_saved_value() const { return m_sSavedValue; }
1320  bool get_value_changed_from_saved() const { return m_sSavedValue != get_selected_text(); }
1321 };
1322 
1323 class VCL_DLLPUBLIC Button : virtual public Container
1324 {
1325  friend class ::LOKTrigger;
1326 
1327 protected:
1329 
1330  void signal_clicked() { m_aClickHdl.Call(*this); }
1331 
1332 public:
1333  virtual void set_label(const OUString& rText) = 0;
1334  // pDevice, the image for the button, or nullptr to unset
1335  virtual void set_image(VirtualDevice* pDevice) = 0;
1336  virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) = 0;
1337  virtual void set_from_icon_name(const OUString& rIconName) = 0;
1338  virtual OUString get_label() const = 0;
1339  virtual void set_label_line_wrap(bool wrap) = 0;
1340  void clicked() { signal_clicked(); }
1341 
1342  // font size is in points, not pixels, e.g. see Window::[G]etPointFont
1343  virtual void set_font(const vcl::Font& rFont) = 0;
1344 
1345  /* Sometimes, a widget should behave like a button (activate on click,
1346  accept keyboard focus, etc), but look entirely different.
1347 
1348  pDevice, the custom look to use, or nullptr to unset.
1349 
1350  Typically doing this is ill advised. Consider using
1351  set_accessible_name if you do. */
1352  virtual void set_custom_button(VirtualDevice* pDevice) = 0;
1353 
1354  void connect_clicked(const Link<Button&, void>& rLink) { m_aClickHdl = rLink; }
1355 };
1356 
1357 class VCL_DLLPUBLIC ToggleButton : virtual public Button
1358 {
1359  friend class ::LOKTrigger;
1360 
1361 protected:
1363  TriState m_eSavedValue = TRISTATE_FALSE;
1364 
1365  void signal_toggled() { m_aToggleHdl.Call(*this); }
1366 
1367 public:
1368  virtual void set_active(bool active) = 0;
1369  virtual bool get_active() const = 0;
1370 
1371  virtual void set_inconsistent(bool inconsistent) = 0;
1372  virtual bool get_inconsistent() const = 0;
1373 
1375  {
1376  if (get_inconsistent())
1377  return TRISTATE_INDET;
1378  else if (get_active())
1379  return TRISTATE_TRUE;
1380  return TRISTATE_FALSE;
1381  }
1382 
1383  void set_state(TriState eState)
1384  {
1385  switch (eState)
1386  {
1387  case TRISTATE_INDET:
1388  set_inconsistent(true);
1389  break;
1390  case TRISTATE_TRUE:
1391  set_inconsistent(false);
1392  set_active(true);
1393  break;
1394  case TRISTATE_FALSE:
1395  set_inconsistent(false);
1396  set_active(false);
1397  break;
1398  }
1399  }
1400 
1401  void save_state() { m_eSavedValue = get_state(); }
1402  TriState get_saved_state() const { return m_eSavedValue; }
1403  bool get_state_changed_from_saved() const { return m_eSavedValue != get_state(); }
1404 
1405  virtual void connect_toggled(const Link<ToggleButton&, void>& rLink) { m_aToggleHdl = rLink; }
1406 };
1407 
1409 {
1413  : eState(TRISTATE_INDET)
1414  , bTriStateEnabled(true)
1415  {
1416  }
1417  void ButtonToggled(ToggleButton& rToggle);
1418 };
1419 
1420 class VCL_DLLPUBLIC MenuButton : virtual public ToggleButton
1421 {
1422 protected:
1424 
1425  void signal_selected(const OString& rIdent) { m_aSelectHdl.Call(rIdent); }
1426 
1427 public:
1428  void connect_selected(const Link<const OString&, void>& rLink) { m_aSelectHdl = rLink; }
1429 
1430  virtual void insert_item(int pos, const OUString& rId, const OUString& rStr,
1431  const OUString* pIconName, VirtualDevice* pImageSurface,
1432  TriState eCheckRadioFalse)
1433  = 0;
1434  void append_item(const OUString& rId, const OUString& rStr)
1435  {
1436  insert_item(-1, rId, rStr, nullptr, nullptr, TRISTATE_INDET);
1437  }
1438  void append_item_check(const OUString& rId, const OUString& rStr)
1439  {
1440  insert_item(-1, rId, rStr, nullptr, nullptr, TRISTATE_TRUE);
1441  }
1442  void append_item_radio(const OUString& rId, const OUString& rStr)
1443  {
1444  insert_item(-1, rId, rStr, nullptr, nullptr, TRISTATE_FALSE);
1445  }
1446  void append_item(const OUString& rId, const OUString& rStr, const OUString& rImage)
1447  {
1448  insert_item(-1, rId, rStr, &rImage, nullptr, TRISTATE_INDET);
1449  }
1450  void append_item(const OUString& rId, const OUString& rStr, VirtualDevice& rImage)
1451  {
1452  insert_item(-1, rId, rStr, nullptr, &rImage, TRISTATE_INDET);
1453  }
1454  virtual void insert_separator(int pos, const OUString& rId) = 0;
1455  void append_separator(const OUString& rId) { insert_separator(-1, rId); }
1456  virtual void remove_item(const OString& rId) = 0;
1457  virtual void clear() = 0;
1458  virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) = 0;
1459  virtual void set_item_active(const OString& rIdent, bool bActive) = 0;
1460  virtual void set_item_label(const OString& rIdent, const OUString& rLabel) = 0;
1461  virtual OUString get_item_label(const OString& rIdent) const = 0;
1462  virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) = 0;
1463  virtual void set_item_visible(const OString& rIdent, bool bVisible) = 0;
1464  virtual OString get_item_help_id(const OString& rIdent) const = 0;
1465 
1466  virtual void set_popover(weld::Widget* pPopover) = 0;
1467 };
1468 
1469 // Similar to a MenuButton except it is split into two parts, a toggle
1470 // button at the start and a menubutton at the end
1472 {
1473 };
1474 
1476 {
1477 };
1478 
1480 {
1481 };
1482 
1483 class VCL_DLLPUBLIC LinkButton : virtual public Container
1484 {
1485 protected:
1487 
1488  bool signal_activate_link() { return m_aActivateLinkHdl.Call(*this); }
1489 
1490 public:
1491  virtual void set_label(const OUString& rText) = 0;
1492  virtual OUString get_label() const = 0;
1493  virtual void set_uri(const OUString& rUri) = 0;
1494  virtual OUString get_uri() const = 0;
1495 
1496  void connect_activate_link(const Link<LinkButton&, bool>& rLink) { m_aActivateLinkHdl = rLink; }
1497 };
1498 
1499 class VCL_DLLPUBLIC Scale : virtual public Widget
1500 {
1501 protected:
1503 
1504  void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
1505 
1506 public:
1507  virtual void set_value(int value) = 0;
1508  virtual int get_value() const = 0;
1509  virtual void set_range(int min, int max) = 0;
1510 
1511  virtual void set_increments(int step, int page) = 0;
1512  virtual void get_increments(int& step, int& page) const = 0;
1513 
1514  void connect_value_changed(const Link<Scale&, void>& rLink) { m_aValueChangedHdl = rLink; }
1515 };
1516 
1517 class VCL_DLLPUBLIC Spinner : virtual public Widget
1518 {
1519 public:
1520  virtual void start() = 0;
1521  virtual void stop() = 0;
1522 };
1523 
1524 class VCL_DLLPUBLIC ProgressBar : virtual public Widget
1525 {
1526 public:
1527  //0-100
1528  virtual void set_percentage(int value) = 0;
1529  virtual OUString get_text() const = 0;
1530  virtual void set_text(const OUString& rText) = 0;
1531 };
1532 
1533 class VCL_DLLPUBLIC Entry : virtual public Widget
1534 {
1535 private:
1536  OUString m_sSavedValue;
1537 
1538 protected:
1543 
1544  friend class ::LOKTrigger;
1545 
1546  void signal_changed() { m_aChangeHdl.Call(*this); }
1547  void signal_cursor_position() { m_aCursorPositionHdl.Call(*this); }
1548 
1549 public:
1550  virtual void set_text(const OUString& rText) = 0;
1551  virtual OUString get_text() const = 0;
1552  virtual void set_width_chars(int nChars) = 0;
1553  virtual int get_width_chars() const = 0;
1554  // The maximum length of the entry. Use 0 for no maximum
1555  virtual void set_max_length(int nChars) = 0;
1556  // nEndPos can be -1 in order to select all text
1557  virtual void select_region(int nStartPos, int nEndPos) = 0;
1558  // returns true if the selection has nonzero length
1559  virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0;
1560  virtual void replace_selection(const OUString& rText) = 0;
1561  // nCursorPos can be -1 to set to the end
1562  virtual void set_position(int nCursorPos) = 0;
1563  virtual int get_position() const = 0;
1564  virtual void set_editable(bool bEditable) = 0;
1565  virtual bool get_editable() const = 0;
1566  virtual void set_message_type(EntryMessageType eType) = 0;
1567  virtual void set_placeholder_text(const OUString& rText) = 0;
1568 
1569  virtual void set_overwrite_mode(bool bOn) = 0;
1570  virtual bool get_overwrite_mode() const = 0;
1571 
1572  // font size is in points, not pixels, e.g. see Window::[G]etPointFont
1573  virtual void set_font(const vcl::Font& rFont) = 0;
1574 
1575  /*
1576  If you want to set a warning or error state, see set_message_type
1577  instead where, if the toolkit supports it, a specific warning/error
1578  indicator is shown.
1579 
1580  This explicit text color method exists to support rendering the
1581  SvNumberformat color feature.
1582  */
1583  virtual void set_font_color(const Color& rColor) = 0;
1584 
1585  virtual void connect_changed(const Link<Entry&, void>& rLink) { m_aChangeHdl = rLink; }
1586  void connect_insert_text(const Link<OUString&, bool>& rLink) { m_aInsertTextHdl = rLink; }
1587  // callback returns true to indicated no further processing of activate wanted
1588  void connect_activate(const Link<Entry&, bool>& rLink) { m_aActivateHdl = rLink; }
1589  virtual void connect_cursor_position(const Link<Entry&, void>& rLink)
1590  {
1591  m_aCursorPositionHdl = rLink;
1592  }
1593 
1594  virtual void cut_clipboard() = 0;
1595  virtual void copy_clipboard() = 0;
1596  virtual void paste_clipboard() = 0;
1597 
1598  virtual void set_alignment(TxtAlign eXAlign) = 0;
1599 
1600  void save_value() { m_sSavedValue = get_text(); }
1601  OUString const& get_saved_value() const { return m_sSavedValue; }
1602  bool get_value_changed_from_saved() const { return m_sSavedValue != get_text(); }
1603 };
1604 
1605 class VCL_DLLPUBLIC SpinButton : virtual public Entry
1606 {
1607  friend class ::LOKTrigger;
1608 
1609 protected:
1613 
1614  void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
1615 
1617  {
1618  if (!m_aOutputHdl.IsSet())
1619  return false;
1620  m_aOutputHdl.Call(*this);
1621  return true;
1622  }
1623 
1624  TriState signal_input(int* result)
1625  {
1626  if (!m_aInputHdl.IsSet())
1627  return TRISTATE_INDET;
1628  return m_aInputHdl.Call(result) ? TRISTATE_TRUE : TRISTATE_FALSE;
1629  }
1630 
1631 public:
1632  virtual void set_value(int value) = 0;
1633  virtual int get_value() const = 0;
1634  virtual void set_range(int min, int max) = 0;
1635  virtual void get_range(int& min, int& max) const = 0;
1636  void set_min(int min)
1637  {
1638  int dummy, max;
1639  get_range(dummy, max);
1640  set_range(min, max);
1641  }
1642  void set_max(int max)
1643  {
1644  int min, dummy;
1645  get_range(min, dummy);
1646  set_range(min, max);
1647  }
1648  int get_min() const
1649  {
1650  int min, dummy;
1651  get_range(min, dummy);
1652  return min;
1653  }
1654  int get_max() const
1655  {
1656  int dummy, max;
1657  get_range(dummy, max);
1658  return max;
1659  }
1660  virtual void set_increments(int step, int page) = 0;
1661  virtual void get_increments(int& step, int& page) const = 0;
1662  virtual void set_digits(unsigned int digits) = 0;
1663  virtual unsigned int get_digits() const = 0;
1664 
1665  void connect_value_changed(const Link<SpinButton&, void>& rLink) { m_aValueChangedHdl = rLink; }
1666 
1667  void connect_output(const Link<SpinButton&, void>& rLink) { m_aOutputHdl = rLink; }
1668  void connect_input(const Link<int*, bool>& rLink) { m_aInputHdl = rLink; }
1669 
1670  int normalize(int nValue) const { return (nValue * Power10(get_digits())); }
1671 
1672  int denormalize(int nValue) const;
1673 
1674  static unsigned int Power10(unsigned int n);
1675 };
1676 
1677 class EntryFormatter;
1678 
1679 // Similar to a SpinButton, but input and output formatting and range/value
1680 // are managed by a more complex Formatter which can support doubles.
1682 {
1683 protected:
1685 
1686  void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
1687 
1688 public:
1689  virtual Formatter& GetFormatter() = 0;
1690  // does not take ownership, and so must be deregistered if pFormatter
1691  // is destroyed
1692  virtual void SetFormatter(weld::EntryFormatter* pFormatter) = 0;
1693 
1695  {
1696  m_aValueChangedHdl = rLink;
1697  }
1698 
1699 private:
1700  friend class EntryFormatter;
1701  virtual void sync_range_from_formatter() = 0;
1702  virtual void sync_value_from_formatter() = 0;
1703  virtual void sync_increments_from_formatter() = 0;
1704 };
1705 
1706 class VCL_DLLPUBLIC Image : virtual public Widget
1707 {
1708 public:
1709  virtual void set_from_icon_name(const OUString& rIconName) = 0;
1710  virtual void set_image(VirtualDevice* pDevice) = 0;
1711  virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) = 0;
1712 };
1713 
1714 class VCL_DLLPUBLIC Calendar : virtual public Widget
1715 {
1716 protected:
1719 
1720  void signal_selected() { m_aSelectedHdl.Call(*this); }
1721  void signal_activated() { m_aActivatedHdl.Call(*this); }
1722 
1723 public:
1724  void connect_selected(const Link<Calendar&, void>& rLink) { m_aSelectedHdl = rLink; }
1725  void connect_activated(const Link<Calendar&, void>& rLink) { m_aActivatedHdl = rLink; }
1726 
1727  virtual void set_date(const Date& rDate) = 0;
1728  virtual Date get_date() const = 0;
1729 };
1730 
1731 // an entry + treeview pair, where the entry autocompletes from the
1732 // treeview list, and selecting something in the list sets the
1733 // entry to that text, i.e. a visually exploded ComboBox
1734 class VCL_DLLPUBLIC EntryTreeView : virtual public ComboBox
1735 {
1736 private:
1737  DECL_DLLPRIVATE_LINK(ClickHdl, weld::TreeView&, void);
1738  DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
1739  void EntryModifyHdl(const weld::Entry& rEntry);
1740 
1741 protected:
1742  std::unique_ptr<Entry> m_xEntry;
1743  std::unique_ptr<TreeView> m_xTreeView;
1744 
1745 public:
1746  EntryTreeView(std::unique_ptr<Entry> xEntry, std::unique_ptr<TreeView> xTreeView);
1747 
1748  virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems,
1749  bool bKeepExisting) override
1750  {
1751  m_xTreeView->freeze();
1752  if (!bKeepExisting)
1753  m_xTreeView->clear();
1754  for (const auto& rItem : rItems)
1755  {
1756  m_xTreeView->insert(-1, rItem.sString, rItem.sId.isEmpty() ? nullptr : &rItem.sId,
1757  rItem.sImage.isEmpty() ? nullptr : &rItem.sImage, nullptr);
1758  }
1759  m_xTreeView->thaw();
1760  }
1761 
1762  virtual void insert(int pos, const OUString& rStr, const OUString* pId,
1763  const OUString* pIconName, VirtualDevice* pImageSurface) override
1764  {
1765  m_xTreeView->insert(pos, rStr, pId, pIconName, pImageSurface);
1766  }
1767 
1768  virtual int get_count() const override { return m_xTreeView->n_children(); }
1769  virtual void clear() override { m_xTreeView->clear(); }
1770 
1771  //by index
1772  virtual int get_active() const override { return m_xTreeView->get_selected_index(); }
1773  virtual void set_active(int pos) override
1774  {
1775  m_xTreeView->set_cursor(pos);
1776  m_xTreeView->select(pos);
1777  m_xEntry->set_text(m_xTreeView->get_selected_text());
1778  }
1779  virtual void remove(int pos) override { m_xTreeView->remove(pos); }
1780 
1781  //by text
1782  virtual OUString get_active_text() const override { return m_xEntry->get_text(); }
1783  virtual OUString get_text(int pos) const override { return m_xTreeView->get_text(pos); }
1784  virtual int find_text(const OUString& rStr) const override
1785  {
1786  return m_xTreeView->find_text(rStr);
1787  }
1788 
1789  //by id
1790  virtual OUString get_active_id() const override { return m_xTreeView->get_selected_id(); }
1791  virtual void set_active_id(const OUString& rStr) override
1792  {
1793  m_xTreeView->select_id(rStr);
1794  m_xEntry->set_text(m_xTreeView->get_selected_text());
1795  }
1796  virtual OUString get_id(int pos) const override { return m_xTreeView->get_id(pos); }
1797  virtual void set_id(int pos, const OUString& rId) override { m_xTreeView->set_id(pos, rId); }
1798  virtual int find_id(const OUString& rId) const override { return m_xTreeView->find_id(rId); }
1799 
1800  //entry related
1801  virtual bool has_entry() const override { return true; }
1802  virtual void set_entry_message_type(EntryMessageType eType) override
1803  {
1804  m_xEntry->set_message_type(eType);
1805  }
1806  virtual void set_entry_text(const OUString& rStr) override { m_xEntry->set_text(rStr); }
1807  virtual void set_entry_width_chars(int nChars) override { m_xEntry->set_width_chars(nChars); }
1808  virtual void set_entry_max_length(int nChars) override { m_xEntry->set_max_length(nChars); }
1809  virtual void select_entry_region(int nStartPos, int nEndPos) override
1810  {
1811  m_xEntry->select_region(nStartPos, nEndPos);
1812  }
1813  //if no text was selected, both rStartPos and rEndPos will be identical
1814  //and false will be returned
1815  virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) override
1816  {
1817  return m_xEntry->get_selection_bounds(rStartPos, rEndPos);
1818  }
1820  {
1821  m_xTreeView->connect_row_activated(rLink);
1822  }
1823 
1824  virtual bool get_popup_shown() const override { return false; }
1825 
1826  void set_height_request_by_rows(int nRows);
1827 };
1828 
1830 {
1832  std::unique_ptr<weld::SpinButton> m_xSpinButton;
1834 
1835  DECL_LINK(spin_button_value_changed, weld::SpinButton&, void);
1836  DECL_LINK(spin_button_output, weld::SpinButton&, void);
1837  DECL_LINK(spin_button_input, int* result, bool);
1838 
1839  void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
1840 
1841  int ConvertValue(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit) const;
1842  OUString format_number(int nValue) const;
1843  void update_width_chars();
1844 
1845 public:
1846  MetricSpinButton(std::unique_ptr<SpinButton> pSpinButton, FieldUnit eSrcUnit)
1847  : m_eSrcUnit(eSrcUnit)
1848  , m_xSpinButton(std::move(pSpinButton))
1849  {
1850  update_width_chars();
1851  m_xSpinButton->connect_output(LINK(this, MetricSpinButton, spin_button_output));
1852  m_xSpinButton->connect_input(LINK(this, MetricSpinButton, spin_button_input));
1853  m_xSpinButton->connect_value_changed(
1854  LINK(this, MetricSpinButton, spin_button_value_changed));
1855  spin_button_output(*m_xSpinButton);
1856  }
1857 
1858  static OUString MetricToString(FieldUnit rUnit);
1859 
1860  FieldUnit get_unit() const { return m_eSrcUnit; }
1861 
1862  void set_unit(FieldUnit eUnit);
1863 
1864  int convert_value_to(int nValue, FieldUnit eValueUnit) const
1865  {
1866  return ConvertValue(nValue, m_eSrcUnit, eValueUnit);
1867  }
1868 
1869  int convert_value_from(int nValue, FieldUnit eValueUnit) const
1870  {
1871  return ConvertValue(nValue, eValueUnit, m_eSrcUnit);
1872  }
1873 
1874  void set_value(int nValue, FieldUnit eValueUnit)
1875  {
1876  m_xSpinButton->set_value(convert_value_from(nValue, eValueUnit));
1877  }
1878 
1879  int get_value(FieldUnit eDestUnit) const
1880  {
1881  return convert_value_to(m_xSpinButton->get_value(), eDestUnit);
1882  }
1883 
1884  // typically you only need to call this if set_text (e.g. with "") was
1885  // previously called to display some arbitrary text instead of the
1886  // formatted value and now you want to show it as formatted again
1887  void reformat() { spin_button_output(*m_xSpinButton); }
1888 
1889  void set_range(int min, int max, FieldUnit eValueUnit)
1890  {
1891  min = convert_value_from(min, eValueUnit);
1892  max = convert_value_from(max, eValueUnit);
1893  m_xSpinButton->set_range(min, max);
1894  update_width_chars();
1895  }
1896 
1897  void get_range(int& min, int& max, FieldUnit eDestUnit) const
1898  {
1899  m_xSpinButton->get_range(min, max);
1900  min = convert_value_to(min, eDestUnit);
1901  max = convert_value_to(max, eDestUnit);
1902  }
1903 
1904  void set_min(int min, FieldUnit eValueUnit)
1905  {
1906  int dummy, max;
1907  get_range(dummy, max, eValueUnit);
1908  set_range(min, max, eValueUnit);
1909  }
1910 
1911  void set_max(int max, FieldUnit eValueUnit)
1912  {
1913  int min, dummy;
1914  get_range(min, dummy, eValueUnit);
1915  set_range(min, max, eValueUnit);
1916  }
1917 
1918  int get_min(FieldUnit eValueUnit) const
1919  {
1920  int min, dummy;
1921  get_range(min, dummy, eValueUnit);
1922  return min;
1923  }
1924 
1925  int get_max(FieldUnit eValueUnit) const
1926  {
1927  int dummy, max;
1928  get_range(dummy, max, eValueUnit);
1929  return max;
1930  }
1931 
1932  void set_increments(int step, int page, FieldUnit eValueUnit)
1933  {
1934  step = convert_value_from(step, eValueUnit);
1935  page = convert_value_from(page, eValueUnit);
1936  m_xSpinButton->set_increments(step, page);
1937  }
1938 
1939  void get_increments(int& step, int& page, FieldUnit eDestUnit) const
1940  {
1941  m_xSpinButton->get_increments(step, page);
1942  step = convert_value_to(step, eDestUnit);
1943  page = convert_value_to(page, eDestUnit);
1944  }
1945 
1947  {
1948  m_aValueChangedHdl = rLink;
1949  }
1950 
1951  int normalize(int nValue) const { return m_xSpinButton->normalize(nValue); }
1952  int denormalize(int nValue) const { return m_xSpinButton->denormalize(nValue); }
1953  void set_sensitive(bool sensitive) { m_xSpinButton->set_sensitive(sensitive); }
1954  bool get_sensitive() const { return m_xSpinButton->get_sensitive(); }
1955  bool get_visible() const { return m_xSpinButton->get_visible(); }
1956  void grab_focus() { m_xSpinButton->grab_focus(); }
1957  bool has_focus() const { return m_xSpinButton->has_focus(); }
1958  void show() { m_xSpinButton->show(); }
1959  void set_visible(bool bShow) { m_xSpinButton->set_visible(bShow); }
1960  void hide() { m_xSpinButton->hide(); }
1961  void set_digits(unsigned int digits);
1962  void set_accessible_name(const OUString& rName) { m_xSpinButton->set_accessible_name(rName); }
1963  unsigned int get_digits() const { return m_xSpinButton->get_digits(); }
1964  void save_value() { m_xSpinButton->save_value(); }
1966  {
1967  return m_xSpinButton->get_value_changed_from_saved();
1968  }
1969  void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); }
1970  OUString get_text() const { return m_xSpinButton->get_text(); }
1971  void set_size_request(int nWidth, int nHeight)
1972  {
1973  m_xSpinButton->set_size_request(nWidth, nHeight);
1974  }
1975  Size get_size_request() const { return m_xSpinButton->get_size_request(); }
1976  Size get_preferred_size() const { return m_xSpinButton->get_preferred_size(); }
1978  {
1979  m_xSpinButton->connect_focus_in(rLink);
1980  }
1982  {
1983  m_xSpinButton->connect_focus_out(rLink);
1984  }
1985  OString get_buildable_name() const { return m_xSpinButton->get_buildable_name(); }
1986  void set_help_id(const OString& rName) { m_xSpinButton->set_help_id(rName); }
1987  void set_position(int nCursorPos) { m_xSpinButton->set_position(nCursorPos); }
1988  // set the width of the underlying widget in characters, this setting is
1989  // invalidated when changing the units, range or digits, so to have effect
1990  // must come after changing those values
1991  void set_width_chars(int nChars) { m_xSpinButton->set_width_chars(nChars); }
1992  weld::SpinButton& get_widget() { return *m_xSpinButton; }
1993 };
1994 
1995 enum class LabelType
1996 {
1997  Normal,
1998  Warning,
1999  Error,
2000  Title, // this is intended to be used against the background set by set_title_background
2001 };
2002 
2003 class VCL_DLLPUBLIC Label : virtual public Widget
2004 {
2005 public:
2006  virtual void set_label(const OUString& rText) = 0;
2007  virtual OUString get_label() const = 0;
2008  virtual void set_mnemonic_widget(Widget* pTarget) = 0;
2009  // font size is in points, not pixels, e.g. see Window::[G]etPointFont
2010  virtual void set_font(const vcl::Font& rFont) = 0;
2011  virtual void set_label_type(LabelType eType) = 0;
2012  /*
2013  If you want to set a warning or error state, see set_label_type
2014  instead.
2015  */
2016  virtual void set_font_color(const Color& rColor) = 0;
2017 };
2018 
2019 class VCL_DLLPUBLIC TextView : virtual public Container
2020 {
2021  friend class ::LOKTrigger;
2022 
2023 private:
2024  OUString m_sSavedValue;
2025 
2026 protected:
2030 
2031  void signal_changed() { m_aChangeHdl.Call(*this); }
2032  void signal_cursor_position() { m_aCursorPositionHdl.Call(*this); }
2033  void signal_vadjustment_changed() { m_aVChangeHdl.Call(*this); }
2034 
2035 public:
2036  virtual void set_text(const OUString& rText) = 0;
2037  virtual OUString get_text() const = 0;
2038  // if nStartPos or nEndPos is -1 the max available text pos will be used
2039  virtual void select_region(int nStartPos, int nEndPos) = 0;
2040  // returns true if the selection has nonzero length
2041  virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0;
2042  virtual void replace_selection(const OUString& rText) = 0;
2043  virtual void set_editable(bool bEditable) = 0;
2044  virtual bool get_editable() const = 0;
2045  virtual void set_monospace(bool bMonospace) = 0;
2046  // The maximum length of the entry. Use 0 for no maximum
2047  virtual void set_max_length(int nChars) = 0;
2048  int get_height_rows(int nRows) const
2049  {
2050  //can improve this if needed
2051  return get_text_height() * nRows;
2052  }
2053 
2054  /*
2055  Typically you want to avoid the temptation of customizing
2056  font colors
2057  */
2058  virtual void set_font_color(const Color& rColor) = 0;
2059 
2060  void save_value() { m_sSavedValue = get_text(); }
2061  bool get_value_changed_from_saved() const { return m_sSavedValue != get_text(); }
2062 
2063  void connect_changed(const Link<TextView&, void>& rLink) { m_aChangeHdl = rLink; }
2065  {
2066  m_aCursorPositionHdl = rLink;
2067  }
2068 
2069  // returns true if pressing up would move the cursor
2070  // doesn't matter if that move is to a previous line or to the start of the
2071  // current line just so long as the cursor would move
2072  virtual bool can_move_cursor_with_up() const = 0;
2073 
2074  // returns true if pressing down would move the cursor
2075  // doesn't matter if that move is to a next line or to the end of the
2076  // current line just so long as the cursor would move
2077  virtual bool can_move_cursor_with_down() const = 0;
2078 
2079  virtual void cut_clipboard() = 0;
2080  virtual void copy_clipboard() = 0;
2081  virtual void paste_clipboard() = 0;
2082 
2083  virtual void set_alignment(TxtAlign eXAlign) = 0;
2084 
2085  virtual int vadjustment_get_value() const = 0;
2086  virtual int vadjustment_get_upper() const = 0;
2087  virtual int vadjustment_get_lower() const = 0;
2088  virtual int vadjustment_get_page_size() const = 0;
2089  virtual void vadjustment_set_value(int value) = 0;
2090  void connect_vadjustment_changed(const Link<TextView&, void>& rLink) { m_aVChangeHdl = rLink; }
2091 };
2092 
2093 class VCL_DLLPUBLIC Expander : virtual public Container
2094 {
2095 protected:
2097 
2098  void signal_expanded() { m_aExpandedHdl.Call(*this); }
2099 
2100 public:
2101  virtual void set_label(const OUString& rText) = 0;
2102  virtual OUString get_label() const = 0;
2103  virtual bool get_expanded() const = 0;
2104  virtual void set_expanded(bool bExpand) = 0;
2105 
2106  void connect_expanded(const Link<Expander&, void>& rLink) { m_aExpandedHdl = rLink; }
2107 };
2108 
2109 class VCL_DLLPUBLIC DrawingArea : virtual public Widget
2110 {
2111 public:
2112  typedef std::pair<vcl::RenderContext&, const tools::Rectangle&> draw_args;
2113 
2114 protected:
2120  // if handler returns true, drag is disallowed
2122  // return position of cursor, fill OUString& with surrounding text
2124  // attempt to delete the range, return true if successful
2126 
2128  {
2129  return m_aQueryTooltipHdl.Call(rHelpArea);
2130  }
2131 
2132  int signal_im_context_get_surrounding(OUString& rSurroundingText)
2133  {
2134  if (!m_aGetSurroundingHdl.IsSet())
2135  return -1;
2136  return m_aGetSurroundingHdl.Call(rSurroundingText);
2137  }
2138 
2140  {
2141  return m_aDeleteSurroundingHdl.Call(rRange);
2142  }
2143 
2144 public:
2145  void connect_draw(const Link<draw_args, void>& rLink) { m_aDrawHdl = rLink; }
2146  void connect_style_updated(const Link<Widget&, void>& rLink) { m_aStyleUpdatedHdl = rLink; }
2147  void connect_command(const Link<const CommandEvent&, bool>& rLink) { m_aCommandHdl = rLink; }
2149  {
2150  m_aGetFocusRectHdl = rLink;
2151  }
2153  {
2154  m_aQueryTooltipHdl = rLink;
2155  }
2156  void connect_drag_begin(const Link<DrawingArea&, bool>& rLink) { m_aDragBeginHdl = rLink; }
2158  {
2159  m_aGetSurroundingHdl = rLink;
2160  }
2162  {
2163  m_aDeleteSurroundingHdl = rLink;
2164  }
2165  virtual void queue_draw() = 0;
2166  virtual void queue_draw_area(int x, int y, int width, int height) = 0;
2167  virtual void queue_resize() = 0;
2168 
2169  virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rTransferrable,
2170  sal_uInt8 eDNDConstants)
2171  = 0;
2172 
2173  virtual void set_cursor(PointerStyle ePointerStyle) = 0;
2174 
2175  virtual void set_input_context(const InputContext& rInputContext) = 0;
2176  virtual void im_context_set_cursor_location(const tools::Rectangle& rCursorRect,
2177  int nExtTextInputWidth)
2178  = 0;
2179 
2180  // use return here just to generate matching VirtualDevices
2181  virtual OutputDevice& get_ref_device() = 0;
2182 
2183  virtual a11yref get_accessible_parent() = 0;
2184  virtual a11yrelationset get_accessible_relation_set() = 0;
2185  virtual Point get_accessible_location() = 0;
2186 
2187 private:
2188  friend class ::LOKTrigger;
2189 
2190  virtual void click(const Point& rPos) = 0;
2191 };
2192 
2194 {
2195 protected:
2197 
2198  void signal_activate(const OString& rIdent) { m_aActivateHdl.Call(rIdent); }
2199 
2200 public:
2201  virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) = 0;
2202 
2203  void connect_activate(const Link<const OString&, void>& rLink) { m_aActivateHdl = rLink; }
2204 
2205  virtual void set_sensitive(const OString& rIdent, bool bSensitive) = 0;
2206  virtual bool get_sensitive(const OString& rIdent) const = 0;
2207  virtual void set_label(const OString& rIdent, const OUString& rLabel) = 0;
2208  virtual OUString get_label(const OString& rIdent) const = 0;
2209  virtual void set_active(const OString& rIdent, bool bActive) = 0;
2210  virtual bool get_active(const OString& rIdent) const = 0;
2211  virtual void set_visible(const OString& rIdent, bool bVisible) = 0;
2212 
2213  virtual void insert(int pos, const OUString& rId, const OUString& rStr,
2214  const OUString* pIconName, VirtualDevice* pImageSurface,
2215  TriState eCheckRadioFalse)
2216  = 0;
2217 
2218  virtual void remove(const OString& rId) = 0;
2219 
2220  virtual void clear() = 0;
2221 
2222  virtual void insert_separator(int pos, const OUString& rId) = 0;
2223  void append_separator(const OUString& rId) { insert_separator(-1, rId); }
2224 
2225  void append(const OUString& rId, const OUString& rStr)
2226  {
2227  insert(-1, rId, rStr, nullptr, nullptr, TRISTATE_INDET);
2228  }
2229  void append_check(const OUString& rId, const OUString& rStr)
2230  {
2231  insert(-1, rId, rStr, nullptr, nullptr, TRISTATE_TRUE);
2232  }
2233  void append_radio(const OUString& rId, const OUString& rStr)
2234  {
2235  insert(-1, rId, rStr, nullptr, nullptr, TRISTATE_FALSE);
2236  }
2237  void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
2238  {
2239  insert(-1, rId, rStr, &rImage, nullptr, TRISTATE_INDET);
2240  }
2241  void append(const OUString& rId, const OUString& rStr, VirtualDevice& rImage)
2242  {
2243  insert(-1, rId, rStr, nullptr, &rImage, TRISTATE_INDET);
2244  }
2245 
2246  // return the number of toplevel nodes
2247  virtual int n_children() const = 0;
2248 
2249  virtual OString get_id(int pos) const = 0;
2250 
2251  virtual ~Menu() {}
2252 };
2253 
2254 class VCL_DLLPUBLIC Toolbar : virtual public Widget
2255 {
2256 protected:
2259 
2260  friend class ::LOKTrigger;
2261 
2262  void signal_clicked(const OString& rIdent) { m_aClickHdl.Call(rIdent); }
2263  void signal_toggle_menu(const OString& rIdent) { m_aToggleMenuHdl.Call(rIdent); }
2264 
2265 public:
2266  virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) = 0;
2267  virtual bool get_item_sensitive(const OString& rIdent) const = 0;
2268  virtual void set_item_active(const OString& rIdent, bool bActive) = 0;
2269  virtual bool get_item_active(const OString& rIdent) const = 0;
2270  virtual void set_menu_item_active(const OString& rIdent, bool bActive) = 0;
2271  virtual bool get_menu_item_active(const OString& rIdent) const = 0;
2272  virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) = 0;
2273  virtual void set_item_popover(const OString& rIdent, weld::Widget* pPopover) = 0;
2274  virtual void set_item_visible(const OString& rIdent, bool bVisible) = 0;
2275  virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) = 0;
2276  virtual bool get_item_visible(const OString& rIdent) const = 0;
2277  virtual void set_item_label(const OString& rIdent, const OUString& rLabel) = 0;
2278  virtual OUString get_item_label(const OString& rIdent) const = 0;
2279  virtual void set_item_tooltip_text(const OString& rIdent, const OUString& rTip) = 0;
2280  virtual OUString get_item_tooltip_text(const OString& rIdent) const = 0;
2281  virtual void set_item_icon_name(const OString& rIdent, const OUString& rIconName) = 0;
2282  virtual void set_item_image(const OString& rIdent,
2283  const css::uno::Reference<css::graphic::XGraphic>& rIcon)
2284  = 0;
2285  virtual void set_item_image(const OString& rIdent, VirtualDevice* pDevice) = 0;
2286 
2287  virtual void insert_separator(int pos, const OUString& rId) = 0;
2288  void append_separator(const OUString& rId) { insert_separator(-1, rId); }
2289 
2290  virtual int get_n_items() const = 0;
2291  virtual OString get_item_ident(int nIndex) const = 0;
2292  virtual void set_item_ident(int nIndex, const OString& rIdent) = 0;
2293  virtual void set_item_label(int nIndex, const OUString& rLabel) = 0;
2294  virtual void set_item_image(int nIndex,
2295  const css::uno::Reference<css::graphic::XGraphic>& rIcon)
2296  = 0;
2297  virtual void set_item_tooltip_text(int nIndex, const OUString& rTip) = 0;
2298 
2299  virtual vcl::ImageType get_icon_size() const = 0;
2300  virtual void set_icon_size(vcl::ImageType eType) = 0;
2301 
2302  // return what modifiers are held
2303  virtual sal_uInt16 get_modifier_state() const = 0;
2304 
2305  // This function returns the position a new item should be inserted if dnd
2306  // is dropped at rPoint
2307  virtual int get_drop_index(const Point& rPoint) const = 0;
2308 
2309  void connect_clicked(const Link<const OString&, void>& rLink) { m_aClickHdl = rLink; }
2310  void connect_menu_toggled(const Link<const OString&, void>& rLink) { m_aToggleMenuHdl = rLink; }
2311 };
2312 
2314 {
2315 public:
2316  virtual void add_widget(weld::Widget* pWidget) = 0;
2317  // the default mode is VclSizeGroupMode::Horizontal
2318  virtual void set_mode(VclSizeGroupMode eMode) = 0;
2319  virtual ~SizeGroup() {}
2320 };
2321 
2323 {
2324 public:
2325  virtual std::unique_ptr<MessageDialog> weld_message_dialog(const OString& id) = 0;
2326  virtual std::unique_ptr<Dialog> weld_dialog(const OString& id) = 0;
2327  virtual std::unique_ptr<Assistant> weld_assistant(const OString& id) = 0;
2328  virtual std::unique_ptr<Widget> weld_widget(const OString& id) = 0;
2329  virtual std::unique_ptr<Container> weld_container(const OString& id) = 0;
2330  virtual std::unique_ptr<Box> weld_box(const OString& id) = 0;
2331  virtual std::unique_ptr<Paned> weld_paned(const OString& id) = 0;
2332  virtual std::unique_ptr<Button> weld_button(const OString& id) = 0;
2333  virtual std::unique_ptr<MenuButton> weld_menu_button(const OString& id) = 0;
2334  virtual std::unique_ptr<MenuToggleButton> weld_menu_toggle_button(const OString& id) = 0;
2335  virtual std::unique_ptr<Frame> weld_frame(const OString& id) = 0;
2336  /* bUserManagedScrolling of true means that the automatic scrolling of the window is disabled
2337  and the owner must specifically listen to adjustment changes and react appropriately to them.
2338  */
2339  virtual std::unique_ptr<ScrolledWindow> weld_scrolled_window(const OString& id,
2340  bool bUserManagedScrolling = false)
2341  = 0;
2342  virtual std::unique_ptr<Notebook> weld_notebook(const OString& id) = 0;
2343  virtual std::unique_ptr<ToggleButton> weld_toggle_button(const OString& id) = 0;
2344  virtual std::unique_ptr<RadioButton> weld_radio_button(const OString& id) = 0;
2345  virtual std::unique_ptr<CheckButton> weld_check_button(const OString& id) = 0;
2346  virtual std::unique_ptr<LinkButton> weld_link_button(const OString& id) = 0;
2347  virtual std::unique_ptr<SpinButton> weld_spin_button(const OString& id) = 0;
2348  virtual std::unique_ptr<MetricSpinButton> weld_metric_spin_button(const OString& id,
2349  FieldUnit eUnit)
2350  = 0;
2351  virtual std::unique_ptr<FormattedSpinButton> weld_formatted_spin_button(const OString& id) = 0;
2352  virtual std::unique_ptr<ComboBox> weld_combo_box(const OString& id) = 0;
2353  virtual std::unique_ptr<TreeView> weld_tree_view(const OString& id) = 0;
2354  virtual std::unique_ptr<IconView> weld_icon_view(const OString& id) = 0;
2355  virtual std::unique_ptr<Label> weld_label(const OString& id) = 0;
2356  virtual std::unique_ptr<TextView> weld_text_view(const OString& id) = 0;
2357  virtual std::unique_ptr<Expander> weld_expander(const OString& id) = 0;
2358  virtual std::unique_ptr<Entry> weld_entry(const OString& id) = 0;
2359  virtual std::unique_ptr<Scale> weld_scale(const OString& id) = 0;
2360  virtual std::unique_ptr<ProgressBar> weld_progress_bar(const OString& id) = 0;
2361  virtual std::unique_ptr<Spinner> weld_spinner(const OString& id) = 0;
2362  virtual std::unique_ptr<Image> weld_image(const OString& id) = 0;
2363  virtual std::unique_ptr<Calendar> weld_calendar(const OString& id) = 0;
2364  virtual std::unique_ptr<DrawingArea>
2365  weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
2366  FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = nullptr)
2367  = 0;
2368  virtual std::unique_ptr<EntryTreeView> weld_entry_tree_view(const OString& containerid,
2369  const OString& entryid,
2370  const OString& treeviewid)
2371  = 0;
2372  virtual std::unique_ptr<Menu> weld_menu(const OString& id) = 0;
2373  virtual std::unique_ptr<Toolbar> weld_toolbar(const OString& id) = 0;
2374  virtual std::unique_ptr<SizeGroup> create_size_group() = 0;
2375  /* return a Dialog suitable to take a screenshot of containing the contents of the .ui file.
2376 
2377  If the toplevel element is a dialog, that will be returned
2378  If the toplevel is not a dialog, a dialog will be created and the contents of the .ui
2379  inserted into it
2380  */
2381  virtual std::unique_ptr<Window> create_screenshot_window() = 0;
2382  virtual ~Builder() {}
2383 };
2384 
2385 class VCL_DLLPUBLIC DialogController : public std::enable_shared_from_this<DialogController>
2386 {
2387 public:
2388  virtual Dialog* getDialog() = 0;
2389  const Dialog* getConstDialog() const
2390  {
2391  return const_cast<DialogController*>(this)->getDialog();
2392  }
2393  virtual short run() { return getDialog()->run(); }
2394  static bool runAsync(const std::shared_ptr<DialogController>& rController,
2395  const std::function<void(sal_Int32)>&);
2396  void set_title(const OUString& rTitle) { getDialog()->set_title(rTitle); }
2397  OUString get_title() const { return getConstDialog()->get_title(); }
2398  void set_help_id(const OString& rHelpId) { getDialog()->set_help_id(rHelpId); }
2399  OString get_help_id() const { return getConstDialog()->get_help_id(); }
2400  void response(int nResponse) { getDialog()->response(nResponse); }
2401  virtual ~DialogController() COVERITY_NOEXCEPT_FALSE;
2402 };
2403 
2405 {
2406 protected:
2407  std::unique_ptr<weld::Builder> m_xBuilder;
2408  std::shared_ptr<weld::Dialog> m_xDialog;
2409 
2410 public:
2411  GenericDialogController(weld::Widget* pParent, const OUString& rUIFile,
2412  const OString& rDialogId, bool bMobile = false);
2413  virtual Dialog* getDialog() override;
2414  virtual ~GenericDialogController() COVERITY_NOEXCEPT_FALSE override;
2415 };
2416 
2417 class VCL_DLLPUBLIC MessageDialogController : public DialogController
2418 {
2419 protected:
2420  std::unique_ptr<weld::Builder> m_xBuilder;
2421  std::unique_ptr<weld::MessageDialog> m_xDialog;
2422  std::unique_ptr<weld::Container> m_xContentArea;
2423  std::unique_ptr<weld::Widget> m_xRelocate;
2424  std::unique_ptr<weld::Container> m_xOrigParent;
2425 
2426 public:
2427  /* @param rRelocateId - optional argument of the name of a widget in the .ui file
2428  which should be relocated into the content area of the dialog.
2429 
2430  e.g. a checkbox for a "Never show this again" option.
2431 
2432  This results in the named widget relocating to the same container
2433  as the messages. This enables aligning the extra widget with the
2434  message labels in the content area container which doesn't
2435  explicitly exist in the ui description, but is only implied.
2436  */
2437  MessageDialogController(weld::Widget* pParent, const OUString& rUIFile,
2438  const OString& rDialogId, const OString& rRelocateId = OString());
2439  virtual Dialog* getDialog() override;
2440  virtual ~MessageDialogController() override;
2441  void set_primary_text(const OUString& rText) { m_xDialog->set_primary_text(rText); }
2442  OUString get_primary_text() const { return m_xDialog->get_primary_text(); }
2443  void set_default_response(int nResponse) { m_xDialog->set_default_response(nResponse); }
2444 };
2445 
2446 class VCL_DLLPUBLIC AssistantController : public DialogController
2447 {
2448 protected:
2449  std::unique_ptr<weld::Builder> m_xBuilder;
2450  std::unique_ptr<weld::Assistant> m_xAssistant;
2451 
2452 public:
2453  AssistantController(weld::Widget* pParent, const OUString& rUIFile, const OString& rDialogId);
2454  virtual Dialog* getDialog() override;
2455  virtual ~AssistantController() override;
2456 };
2457 }
2458 #endif
2459 
2460 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void append_item_check(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:1438
OUString const & get_saved_value() const
Definition: weld.hxx:1319
Link< const Size &, void > m_aSizeAllocateHdl
Definition: weld.hxx:82
std::shared_ptr< weld::Dialog > m_xDialog
Definition: weld.hxx:2408
void remove_text(const OUString &rText)
Definition: weld.hxx:1005
void append(const OUString &rId, const OUString &rStr, VirtualDevice &rImage)
Definition: weld.hxx:2241
virtual void connect_changed(const Link< Entry &, void > &rLink)
Definition: weld.hxx:1585
void connect_activate_link(const Link< LinkButton &, bool > &rLink)
Definition: weld.hxx:1496
void set_size_request(int nWidth, int nHeight)
Definition: weld.hxx:1971
void connect_row_activated(const Link< TreeView &, bool > &rLink)
Definition: weld.hxx:1819
int get_min() const
Definition: weld.hxx:1648
FieldUnit
rEdit set_text(aStr)
virtual void set_sort_func(const std::function< int(const weld::TreeIter &, const weld::TreeIter &)> &func)
Definition: weld.hxx:1182
Link< const OString &, void > m_aClickHdl
Definition: weld.hxx:2257
Link< ComboBox &, bool > m_aEntryActivateHdl
Definition: weld.hxx:651
std::tuple< vcl::RenderContext &, const tools::Rectangle &, bool, const OUString & > render_args
Definition: weld.hxx:646
void sort_native_button_order(const VclBox &rContainer)
Definition: layout.cxx:828
OUString get_primary_text() const
Definition: weld.hxx:2442
virtual OUString get_text(int pos) const override
Definition: weld.hxx:1783
virtual void connect_focus_out(const Link< Widget &, void > &rLink)
Definition: weld.hxx:225
void set_title(const OUString &rTitle)
Definition: weld.hxx:2396
void signal_custom_render(vcl::RenderContext &rDevice, const tools::Rectangle &rRect, bool bSelected, const OUString &rId)
Definition: weld.hxx:877
OUString const & get_saved_value() const
Definition: weld.hxx:766
std::vector< OUString > get_selected_rows_text() const
Definition: weld.hxx:1006
void connect_im_context_get_surrounding(const Link< OUString &, int > &rLink)
Definition: weld.hxx:2157
Link< Button &, void > m_aClickHdl
Definition: weld.hxx:1328
int convert_value_to(int nValue, FieldUnit eValueUnit) const
Definition: weld.hxx:1864
const OString & GetHelpId() const
Definition: weld.hxx:454
void connect_column_clicked(const Link< int, void > &rLink)
Definition: weld.hxx:950
void append_separator(const OUString &rId)
Definition: weld.hxx:935
Link< Widget &, void > m_aFocusOutHdl
Definition: weld.hxx:80
std::unique_ptr< weld::Builder > m_xBuilder
Definition: weld.hxx:2407
void connect_entry_activate(const Link< ComboBox &, bool > &rLink)
Definition: weld.hxx:763
css::uno::Reference< css::accessibility::XAccessibleRelationSet > a11yrelationset
Definition: weld.hxx:46
void append(const OUString &rId, const OUString &rStr, const OUString &rImage)
Definition: weld.hxx:925
virtual void connect_editing(const Link< const TreeIter &, bool > &rStartLink, const Link< const iter_string &, bool > &rEndLink)
Definition: weld.hxx:1133
OUString sId
Definition: weld.hxx:609
void insert_text(int pos, const OUString &rStr)
Definition: weld.hxx:676
void connect_style_updated(const Link< Widget &, void > &rLink)
Definition: weld.hxx:2146
void remove_id(const OUString &rText)
Definition: weld.hxx:1021
void unselect_all()
Definition: weld.hxx:1163
void append_page(const OString &rIdent, const OUString &rLabel)
Definition: weld.hxx:429
void signal_cursor_position()
Definition: weld.hxx:2032
void append_separator(const OUString &rId)
Definition: weld.hxx:694
Link< const CommandEvent &, bool > m_aPopupMenuHdl
Definition: weld.hxx:843
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
bool get_visible() const
Definition: weld.hxx:1955
void insert_text(int pos, const OUString &rStr)
Definition: weld.hxx:913
std::vector< ScreenShotEntry > ScreenShotCollection
Definition: weld.hxx:461
css::uno::Reference< css::accessibility::XAccessible > a11yref
Definition: weld.hxx:45
OUString m_sSavedValue
Definition: weld.hxx:2024
bool get_value_changed_from_saved() const
Definition: weld.hxx:767
bool get_state_changed_from_saved() const
Definition: weld.hxx:1403
OUString m_sSavedValue
Definition: weld.hxx:827
Link< Calendar &, void > m_aSelectedHdl
Definition: weld.hxx:1717
virtual OUString get_id(int pos) const override
Definition: weld.hxx:1796
void append(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:921
virtual OUString get_active_text() const override
Definition: weld.hxx:1782
Link< Widget &, void > m_aStyleUpdatedHdl
Definition: weld.hxx:2116
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual void connect_popup_toggled(const Link< ComboBox &, void > &rLink)
Definition: weld.hxx:731
void connect_help(const Link< Widget &, bool > &rLink)
Definition: weld.hxx:501
#define max(a, b)
void connect_toggled(const Link< const iter_col &, void > &rLink)
Definition: weld.hxx:948
virtual ~Builder()
Definition: weld.hxx:2382
std::unique_ptr< weld::Builder > m_xBuilder
Definition: weld.hxx:2420
void select_all()
Definition: weld.hxx:1312
std::unique_ptr< weld::Widget > m_xRelocate
Definition: weld.hxx:2423
virtual void set_active_id(const OUString &rStr) override
Definition: weld.hxx:1791
OUString get_text() const
Definition: weld.hxx:1970
Link< const Selection &, bool > m_aDeleteSurroundingHdl
Definition: weld.hxx:2125
SelectionMode
Definition: vclenum.hxx:26
virtual void clear() override
Definition: weld.hxx:1769
void connect_model_changed(const Link< TreeView &, void > &rLink)
Definition: weld.hxx:951
void connect_focus_rect(const Link< Widget &, tools::Rectangle > &rLink)
Definition: weld.hxx:2148
virtual void insert(int pos, const OUString &rStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface) override
Definition: weld.hxx:1762
Link< SpinButton &, void > m_aOutputHdl
Definition: weld.hxx:1611
Size signal_custom_get_size(vcl::RenderContext &rDevice, const OUString &rId)
Definition: weld.hxx:884
virtual void connect_visible_range_changed(const Link< TreeView &, void > &rLink)
Definition: weld.hxx:1144
int normalize(int nValue) const
Definition: weld.hxx:1670
Link< get_size_args, Size > m_aGetSizeHdl
Definition: weld.hxx:883
void signal_vadjustment_changed()
Definition: weld.hxx:359
void connect_insert_text(const Link< OUString &, bool > &rLink)
Definition: weld.hxx:1586
virtual void signal_popup_toggled()
Definition: weld.hxx:658
void append(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:681
Link< OUString &, bool > m_aInsertTextHdl
Definition: weld.hxx:1540
void connect_custom_render(const Link< render_args, void > &rLink)
Definition: weld.hxx:1216
void append(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:2225
ComboBoxEntry(const OUString &rString, const OUString &rId, const OUString &rImage)
Definition: weld.hxx:620
std::pair< vcl::RenderContext &, const tools::Rectangle & > draw_args
Definition: weld.hxx:2112
void set_max(int max, FieldUnit eValueUnit)
Definition: weld.hxx:1911
weld::SpinButton & get_widget()
Definition: weld.hxx:1992
void signal_changed()
Definition: weld.hxx:2031
Link< const TreeIter &, bool > m_aCollapsingHdl
Definition: weld.hxx:839
Link< TextView &, void > m_aChangeHdl
Definition: weld.hxx:2027
void set_width_chars(int nChars)
Definition: weld.hxx:1991
virtual void connect_query_tooltip(const Link< const TreeIter &, OUString > &rLink)
Definition: weld.hxx:890
TRISTATE_TRUE
void get_range(int &min, int &max, FieldUnit eDestUnit) const
Definition: weld.hxx:1897
void connect_focus_out(const Link< Widget &, void > &rLink)
Definition: weld.hxx:1981
Link< TextView &, void > m_aCursorPositionHdl
Definition: weld.hxx:2029
virtual void connect_toggled(const Link< ToggleButton &, void > &rLink)
Definition: weld.hxx:1405
void insert(int nRow, TreeIter *pRet=nullptr)
Definition: weld.hxx:901
MetricSpinButton(std::unique_ptr< SpinButton > pSpinButton, FieldUnit eSrcUnit)
Definition: weld.hxx:1846
Link< const CommandEvent &, bool > m_aCommandHdl
Definition: weld.hxx:2117
std::unique_ptr< weld::Builder > m_xBuilder
Definition: weld.hxx:2449
int normalize(int nValue) const
Definition: weld.hxx:1951
std::unique_ptr< weld::Container > m_xOrigParent
Definition: weld.hxx:2424
Link< IconView &, bool > m_aItemActivatedHdl
Definition: weld.hxx:1250
def position
void connect_selected(const Link< const OString &, void > &rLink)
Definition: weld.hxx:1428
Link< const OString &, void > m_aSelectHdl
Definition: weld.hxx:1423
void connect_value_changed(const Link< MetricSpinButton &, void > &rLink)
Definition: weld.hxx:1946
void connect_changed(const Link< TreeView &, void > &rLink)
Definition: weld.hxx:937
bool signal_jump_page(const OString &rIdent)
Definition: weld.hxx:585
void append_item(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:1434
int get_max(FieldUnit eValueUnit) const
Definition: weld.hxx:1925
void append(const OUString &rId, const OUString &rStr, const VirtualDevice *pImage)
Definition: weld.hxx:1269
#define min(a, b)
Link< IconView &, void > m_aSelectionChangeHdl
Definition: weld.hxx:1249
void append_text(const OUString &rStr)
Definition: weld.hxx:917
EntryMessageType
Definition: weld.hxx:628
void get_increments(int &step, int &page, FieldUnit eDestUnit) const
Definition: weld.hxx:1939
void signal_clicked(const OString &rIdent)
Definition: weld.hxx:2262
void signal_vadjustment_changed()
Definition: weld.hxx:2033
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
size_t pos
Link< const MouseEvent &, bool > m_aMousePressHdl
Definition: weld.hxx:85
ComboBoxEntry(const OUString &rString)
Definition: weld.hxx:611
std::pair< const TreeIter &, int > iter_col
Definition: weld.hxx:819
Link< OUString &, bool > m_aEntryInsertTextHdl
Definition: weld.hxx:652
std::unique_ptr< weld::SpinButton > m_xSpinButton
Definition: weld.hxx:1832
virtual void connect_mouse_release(const Link< const MouseEvent &, bool > &rLink)
Definition: weld.hxx:270
LabelType
Definition: weld.hxx:1995
Link< vcl::RenderContext &, Size > m_aGetSizeHdl
Definition: weld.hxx:667
Link< TreeView &, void > m_aVisibleRangeChangedHdl
Definition: weld.hxx:840
VclSizeGroupMode
Definition: vclenum.hxx:265
OUString sImage
Definition: weld.hxx:610
void set_accessible_name(const OUString &rName)
Definition: weld.hxx:1962
Link< const iter_col &, void > m_aRadioToggleHdl
Definition: weld.hxx:833
void connect_selection_changed(const Link< IconView &, void > &rLink)
Definition: weld.hxx:1274
WindowStateMask
Definition: vclenum.hxx:123
void connect_custom_get_size(const Link< get_size_args, Size > &rLink)
Definition: weld.hxx:1215
void connect_entry_insert_text(const Link< OUString &, bool > &rLink)
Definition: weld.hxx:757
OUString sString
Definition: weld.hxx:608
Mode eMode
void signal_selected(const OString &rIdent)
Definition: weld.hxx:1425
bool signal_im_context_delete_surrounding(const Selection &rRange)
Definition: weld.hxx:2139
OUString signal_query_tooltip(const TreeIter &rIter)
Definition: weld.hxx:874
std::unique_ptr< TreeView > m_xTreeView
Definition: weld.hxx:1743
void save_value()
Definition: weld.hxx:1208
virtual ~Widget()
Definition: weld.hxx:320
def run
VclPolicyType
Definition: vclenum.hxx:273
Link< const MouseEvent &, bool > m_aMouseMotionHdl
Definition: weld.hxx:86
virtual void connect_mouse_move(const Link< const MouseEvent &, bool > &rLink)
Definition: weld.hxx:264
Link< TextView &, void > m_aVChangeHdl
Definition: weld.hxx:2028
virtual void set_active(int pos) override
Definition: weld.hxx:1773
bool signal_collapsing(const TreeIter &rIter)
Definition: weld.hxx:857
Link< OUString &, int > m_aGetSurroundingHdl
Definition: weld.hxx:2123
TRISTATE_INDET
void set_position(int nCursorPos)
Definition: weld.hxx:1987
void signal_clicked()
Definition: weld.hxx:1330
void save_value()
Definition: weld.hxx:2060
basegfx::B2IRange maB2IRange
Definition: weld.hxx:458
void save_value()
Definition: weld.hxx:765
void connect_row_activated(const Link< TreeView &, bool > &rLink)
Definition: weld.hxx:945
Link< const TreeIter &, bool > m_aEditingStartedHdl
Definition: weld.hxx:834
void connect_enter_page(const Link< const OString &, void > &rLink)
Definition: weld.hxx:440
void connect_drag_begin(const Link< DrawingArea &, bool > &rLink)
Definition: weld.hxx:2156
void set_text(const OUString &rText)
Definition: weld.hxx:1969
DocumentType eType
Link< draw_args, void > m_aDrawHdl
Definition: weld.hxx:2115
void signal_toggled()
Definition: weld.hxx:1365
void connect_vadjustment_changed(const Link< TextView &, void > &rLink)
Definition: weld.hxx:2090
void connect_im_context_delete_surrounding(const Link< const Selection &, bool > &rLink)
Definition: weld.hxx:2161
void swap(cow_wrapper< T, P > &a, cow_wrapper< T, P > &b)
void append(const OUString &rId, const OUString &rStr, VirtualDevice &rImage)
Definition: weld.hxx:689
void set_range(int min, int max, FieldUnit eValueUnit)
Definition: weld.hxx:1889
Size get_preferred_size() const
Definition: weld.hxx:1976
void connect_clicked(const Link< Button &, void > &rLink)
Definition: weld.hxx:1354
void set_active_text(const OUString &rStr)
Definition: weld.hxx:707
Link< MetricSpinButton &, void > m_aValueChangedHdl
Definition: weld.hxx:1833
void signal_expanded()
Definition: weld.hxx:2098
Link< TreeView &, void > m_aChangeHdl
Definition: weld.hxx:830
virtual int find_id(const OUString &rId) const override
Definition: weld.hxx:1798
virtual void insert_vector(const std::vector< weld::ComboBoxEntry > &rItems, bool bKeepExisting) override
Definition: weld.hxx:1748
Link< SpinButton &, void > m_aValueChangedHdl
Definition: weld.hxx:1610
void set_min(int min)
Definition: weld.hxx:1636
int i
bool get_value_changed_from_saved() const
Definition: weld.hxx:2061
void signal_activate(const OString &rIdent)
Definition: weld.hxx:2198
uno_Any a
virtual int get_count() const override
Definition: weld.hxx:1768
ImageType
Definition: vclenum.hxx:326
void connect_changed(const Link< ComboBox &, void > &rLink)
Definition: weld.hxx:727
bool signal_output()
Definition: weld.hxx:1616
void signal_changed()
Definition: weld.hxx:1546
Link< Widget &, void > m_aTopLevelFocusChangedHdl
Definition: weld.hxx:467
void append_item(const OUString &rId, const OUString &rStr, VirtualDevice &rImage)
Definition: weld.hxx:1450
void unselect_all()
Definition: weld.hxx:1313
TriState get_saved_state() const
Definition: weld.hxx:1402
OUString const & get_saved_value() const
Definition: weld.hxx:1209
Link< Entry &, void > m_aCursorPositionHdl
Definition: weld.hxx:1541
virtual void connect_cursor_position(const Link< Entry &, void > &rLink)
Definition: weld.hxx:1589
void connect_expanding(const Link< const TreeIter &, bool > &rLink)
Definition: weld.hxx:1128
void connect_custom_get_size(const Link< vcl::RenderContext &, Size > &rLink)
Definition: weld.hxx:770
void append_item(const OUString &rId, const OUString &rStr, const OUString &rImage)
Definition: weld.hxx:1446
void signal_cursor_position()
Definition: weld.hxx:1547
TRISTATE_FALSE
void remove_text(const OUString &rText)
Definition: weld.hxx:710
Link< ScrolledWindow &, void > m_aVChangeHdl
Definition: weld.hxx:356
virtual ~TreeIter()
Definition: weld.hxx:806
void connect_selected(const Link< Calendar &, void > &rLink)
Definition: weld.hxx:1724
void connect_item_activated(const Link< IconView &, bool > &rLink)
Definition: weld.hxx:1285
std::unique_ptr< weld::Container > m_xContentArea
Definition: weld.hxx:2422
void append_radio(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:2233
void append(const OUString &rId, const OUString &rStr, const OUString &rImage)
Definition: weld.hxx:1264
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:303
void connect_leave_page(const Link< const OString &, bool > &rLink)
Definition: weld.hxx:438
void signal_toplevel_focus_changed()
Definition: weld.hxx:469
void signal_model_changed()
Definition: weld.hxx:862
virtual void select_entry_region(int nStartPos, int nEndPos) override
Definition: weld.hxx:1809
Link< Entry &, void > m_aChangeHdl
Definition: weld.hxx:1539
virtual bool get_popup_shown() const override
Definition: weld.hxx:1824
Link< const OString &, void > m_aEnterPageHdl
Definition: weld.hxx:418
bool get_value_changed_from_saved() const
Definition: weld.hxx:1320
void signal_toggle_menu(const OString &rIdent)
Definition: weld.hxx:2263
Size get_size_request() const
Definition: weld.hxx:1975
void connect_jump_page(const Link< const OString &, bool > &rLink)
Definition: weld.hxx:603
Link< int, void > m_aColumnClickedHdl
Definition: weld.hxx:832
const basegfx::B2IRange & getB2IRange() const
Definition: weld.hxx:452
void connect_collapsing(const Link< const TreeIter &, bool > &rLink)
Definition: weld.hxx:1129
Link< bool &, bool > m_aDragBeginHdl
Definition: weld.hxx:846
void signal_changed()
Definition: weld.hxx:850
Link< ComboBox &, void > m_aChangeHdl
Definition: weld.hxx:649
ScreenShotEntry(const OString &rHelpId, const basegfx::B2IRange &rB2IRange)
Definition: weld.hxx:446
virtual ~Menu()
Definition: weld.hxx:2251
void set_value(int nValue, FieldUnit eValueUnit)
Definition: weld.hxx:1874
Link< ToggleButton &, void > m_aToggleHdl
Definition: weld.hxx:1362
void connect_value_changed(const Link< Scale &, void > &rLink)
Definition: weld.hxx:1514
void signal_selected()
Definition: weld.hxx:1720
def stop
weld::Window * m_pWindow
Definition: weld.hxx:521
virtual void connect_focus_in(const Link< Widget &, void > &rLink)
Definition: weld.hxx:219
void set_help_id(const OString &rHelpId)
Definition: weld.hxx:2398
Link< ScrolledWindow &, void > m_aHChangeHdl
Definition: weld.hxx:357
OUString m_sSavedValue
Definition: weld.hxx:1246
Link< const KeyEvent &, bool > m_aKeyPressHdl
Definition: weld.hxx:83
void set_default_response(int nResponse)
Definition: weld.hxx:2443
void append_separator(const OUString &rId)
Definition: weld.hxx:1455
virtual int get_active() const override
Definition: weld.hxx:1772
virtual void connect_cursor_position(const Link< TextView &, void > &rLink)
Definition: weld.hxx:2064
bool get_sensitive() const
Definition: weld.hxx:1954
OUString m_sSavedValue
Definition: weld.hxx:641
int signal_im_context_get_surrounding(OUString &rSurroundingText)
Definition: weld.hxx:2132
Link< const MouseEvent &, bool > m_aMouseReleaseHdl
Definition: weld.hxx:87
Link< Widget &, tools::Rectangle > m_aGetFocusRectHdl
Definition: weld.hxx:2118
void signal_hadjustment_changed()
Definition: weld.hxx:360
void save_value()
Definition: weld.hxx:1318
Link< TreeView &, bool > m_aRowActivatedHdl
Definition: weld.hxx:831
bool get_value_changed_from_saved() const
Definition: weld.hxx:1965
bool signal_expanding(const TreeIter &rIter)
Definition: weld.hxx:853
void connect_custom_render(const Link< render_args, void > &rLink)
Definition: weld.hxx:774
Link< Widget &, bool > m_aHelpRequestHdl
Definition: weld.hxx:466
void save_state()
Definition: weld.hxx:1401
bool has_focus() const
Definition: weld.hxx:1957
void connect_drag_begin(const Link< bool &, bool > &rLink)
Definition: weld.hxx:1159
virtual void connect_key_press(const Link< const KeyEvent &, bool > &rLink)
Definition: weld.hxx:246
void set_visible(bool bShow)
Definition: weld.hxx:1959
void connect_activate(const Link< const OString &, void > &rLink)
Definition: weld.hxx:2203
Link< Entry &, bool > m_aActivateHdl
Definition: weld.hxx:1542
Link< TreeView &, void > m_aModelChangedHdl
Definition: weld.hxx:841
void response(int nResponse)
Definition: weld.hxx:2400
void set_increments(int step, int page, FieldUnit eValueUnit)
Definition: weld.hxx:1932
bool signal_activate_link()
Definition: weld.hxx:1488
void set_primary_text(const OUString &rText)
Definition: weld.hxx:2441
int get_min(FieldUnit eValueUnit) const
Definition: weld.hxx:1918
void insert(int pos, const OUString &rStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface)
Definition: weld.hxx:908
Link< FormattedSpinButton &, void > m_aValueChangedHdl
Definition: weld.hxx:1684
ColumnToggleType
Definition: weld.hxx:791
OUString signal_query_tooltip(tools::Rectangle &rHelpArea)
Definition: weld.hxx:2127
void set_help_id(const OString &rName)
Definition: weld.hxx:1986
void select_all()
Definition: weld.hxx:1162
void connect_query_tooltip(const Link< tools::Rectangle &, OUString > &rLink)
Definition: weld.hxx:2152
void signal_changed()
Definition: weld.hxx:656
int convert_value_from(int nValue, FieldUnit eValueUnit) const
Definition: weld.hxx:1869
int get_checkbox_column_width() const
Definition: weld.hxx:1198
void append_separator(const OUString &rId)
Definition: weld.hxx:2288
bool equal(Pair const &p1, Pair const &p2)
void signal_value_changed()
Definition: weld.hxx:1839
Link< const KeyEvent &, bool > m_aKeyReleaseHdl
Definition: weld.hxx:84
bool get_value_changed_from_saved() const
Definition: weld.hxx:1210
void signal_custom_render(vcl::RenderContext &rDevice, const tools::Rectangle &rRect, bool bSelected, const OUString &rId)
Definition: weld.hxx:661
void signal_visible_range_changed()
Definition: weld.hxx:861
WaitObject(weld::Window *pWindow)
Definition: weld.hxx:524
OString get_help_id() const
Definition: weld.hxx:2399
Link< const OString &, bool > m_aJumpPageHdl
Definition: weld.hxx:583
void connect_changed(const Link< TextView &, void > &rLink)
Definition: weld.hxx:2063
Link< DrawingArea &, bool > m_aDragBeginHdl
Definition: weld.hxx:2121
Size signal_custom_get_size(vcl::RenderContext &rDevice)
Definition: weld.hxx:668
Definition: menu.hxx:121
virtual void connect_key_release(const Link< const KeyEvent &, bool > &rLink)
Definition: weld.hxx:252
A widget used to choose from a list of items.
Definition: weld.hxx:638
OString get_buildable_name() const
Definition: weld.hxx:1985
void remove_id(const OUString &rId)
Definition: weld.hxx:718
ComboBoxEntry(const OUString &rString, const OUString &rId)
Definition: weld.hxx:615
void append_check(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:2229
virtual void set_busy_cursor(bool bBusy)=0
void select_text(const OUString &rText)
Definition: weld.hxx:1004
Link< const iter_string &, bool > m_aEditingDoneHdl
Definition: weld.hxx:835
bool iter_nth_child(TreeIter &rIter, int nChild) const
Definition: weld.hxx:1047
void signal_activated()
Definition: weld.hxx:1721
std::tuple< vcl::RenderContext &, const tools::Rectangle &, bool, const OUString & > render_args
Definition: weld.hxx:824
virtual bool get_entry_selection_bounds(int &rStartPos, int &rEndPos) override
Definition: weld.hxx:1815
void connect_input(const Link< int *, bool > &rLink)
Definition: weld.hxx:1668
unsigned char sal_uInt8
OutputDevice RenderContext
Definition: outdev.hxx:291
OUString const & get_saved_value() const
Definition: weld.hxx:1601
virtual void connect_size_allocate(const Link< const Size &, void > &rLink)
Definition: weld.hxx:240
void connect_vadjustment_changed(const Link< ScrolledWindow &, void > &rLink)
Definition: weld.hxx:397
virtual void set_entry_width_chars(int nChars) override
Definition: weld.hxx:1807
void clicked()
Definition: weld.hxx:1340
virtual void set_entry_message_type(EntryMessageType eType) override
Definition: weld.hxx:1802
TriState get_state() const
Definition: weld.hxx:1374
bool signal_editing_started(const TreeIter &rIter)
Definition: weld.hxx:866
virtual void connect_mouse_press(const Link< const MouseEvent &, bool > &rLink)
Definition: weld.hxx:258
bool signal_row_activated()
Definition: weld.hxx:851
bool get_value_changed_from_saved() const
Definition: weld.hxx:1602
virtual void set_entry_max_length(int nChars) override
Definition: weld.hxx:1808
void append(const OUString &rId, const OUString &rStr, const OUString &rImage)
Definition: weld.hxx:2237
void connect_menu_toggled(const Link< const OString &, void > &rLink)
Definition: weld.hxx:2310
void connect_command(const Link< const CommandEvent &, bool > &rLink)
Definition: weld.hxx:2147
std::function< int(const weld::TreeIter &, const weld::TreeIter &)> m_aCustomSort
Definition: weld.hxx:847
friend DialogController
Definition: weld.hxx:542
virtual ~SizeGroup()
Definition: weld.hxx:2319
void set_min(int min, FieldUnit eValueUnit)
Definition: weld.hxx:1904
void signal_value_changed()
Definition: weld.hxx:1504
void connect_value_changed(const Link< FormattedSpinButton &, void > &rLink)
Definition: weld.hxx:1694
void set_sensitive(bool sensitive)
Definition: weld.hxx:1953
TxtAlign
Definition: vclenum.hxx:362
void save_value()
Definition: weld.hxx:1600
virtual short run()
Definition: weld.hxx:2393
Link< render_args, void > m_aRenderHdl
Definition: weld.hxx:876
void signal_toggled(const iter_col &rIterCol)
Definition: weld.hxx:864
bool signal_item_activated()
Definition: weld.hxx:1253
Link< Scale &, void > m_aValueChangedHdl
Definition: weld.hxx:1502
Any value
virtual void connect_toplevel_focus_changed(const Link< Widget &, void > &rLink)
Definition: weld.hxx:502
PointerStyle
Definition: ptrstyle.hxx:25
bool iter_nth_sibling(TreeIter &rIter, int nChild) const
Definition: weld.hxx:1040
void connect_activate(const Link< Entry &, bool > &rLink)
Definition: weld.hxx:1588
void append_separator(const OUString &rId)
Definition: weld.hxx:2223
virtual void set_id(int pos, const OUString &rId) override
Definition: weld.hxx:1797
Link< const TreeIter &, bool > m_aExpandingHdl
Definition: weld.hxx:837
OUString get_title() const
Definition: weld.hxx:2397
void append(TreeIter *pRet=nullptr)
Definition: weld.hxx:906
void select_id(const OUString &rId)
Definition: weld.hxx:1020
void connect_draw(const Link< draw_args, void > &rLink)
Definition: weld.hxx:2145
sal_Int64 ConvertValue(sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, FieldUnit eOutUnit)
Definition: field.cxx:1047
void connect_activated(const Link< Calendar &, void > &rLink)
Definition: weld.hxx:1725
void signal_selection_changed()
Definition: weld.hxx:1252
virtual void set_entry_text(const OUString &rStr) override
Definition: weld.hxx:1806
void connect_clicked(const Link< const OString &, void > &rLink)
Definition: weld.hxx:2309
int get_value(FieldUnit eDestUnit) const
Definition: weld.hxx:1879
Link< const OString &, void > m_aToggleMenuHdl
Definition: weld.hxx:2258
Link< const OString &, bool > m_aLeavePageHdl
Definition: weld.hxx:417
int get_max() const
Definition: weld.hxx:1654
void append_text(const OUString &rStr)
Definition: weld.hxx:680
FieldUnit m_eSrcUnit
Definition: weld.hxx:1831
void set_state(TriState eState)
Definition: weld.hxx:1383
Link< int *, bool > m_aInputHdl
Definition: weld.hxx:1612
TriState signal_input(int *result)
Definition: weld.hxx:1624
Link< const TreeIter &, OUString > m_aQueryTooltipHdl
Definition: weld.hxx:873
std::pair< vcl::RenderContext &, const OUString & > get_size_args
Definition: weld.hxx:822
unsigned int get_digits() const
Definition: weld.hxx:1963
Link< Expander &, void > m_aExpandedHdl
Definition: weld.hxx:2096
Link< Widget &, void > m_aFocusInHdl
Definition: weld.hxx:79
void append_item_radio(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:1442
void set_max(int max)
Definition: weld.hxx:1642
OUString m_sSavedValue
Definition: weld.hxx:1536
FieldUnit get_unit() const
Definition: weld.hxx:1860
void connect_expanded(const Link< Expander &, void > &rLink)
Definition: weld.hxx:2106
Link< ComboBox &, void > m_aPopupToggledHdl
Definition: weld.hxx:650
virtual OUString get_active_id() const override
Definition: weld.hxx:1790
TriState
int get_height_rows(int nRows) const
Definition: weld.hxx:2048
void signal_value_changed()
Definition: weld.hxx:1614
void connect_output(const Link< SpinButton &, void > &rLink)
Definition: weld.hxx:1667
void append(const OUString &rId, const OUString &rStr, const OUString &rImage)
Definition: weld.hxx:685
void connect_hadjustment_changed(const Link< ScrolledWindow &, void > &rLink)
Definition: weld.hxx:376
virtual void connect_popup_menu(const Link< const CommandEvent &, bool > &rLink)
Definition: weld.hxx:1150
std::unique_ptr< weld::Assistant > m_xAssistant
Definition: weld.hxx:2450
Link< const OString &, void > m_aActivateHdl
Definition: weld.hxx:2196
Link< Calendar &, void > m_aActivatedHdl
Definition: weld.hxx:1718
std::pair< const TreeIter &, OUString > iter_string
Definition: weld.hxx:820
std::unique_ptr< Entry > m_xEntry
Definition: weld.hxx:1742
std::unique_ptr< weld::MessageDialog > m_xDialog
Definition: weld.hxx:2421
void connect_focus_in(const Link< Widget &, void > &rLink)
Definition: weld.hxx:1977
const Dialog * getConstDialog() const
Definition: weld.hxx:2389
int denormalize(int nValue) const
Definition: weld.hxx:1952
void signal_column_clicked(int nColumn)
Definition: weld.hxx:852
Link< LinkButton &, bool > m_aActivateLinkHdl
Definition: weld.hxx:1486
Link< Widget &, bool > m_aMnemonicActivateHdl
Definition: weld.hxx:81
virtual void set_visible(bool visible)
Definition: weld.hxx:100
void append(const TreeIter *pParent, const OUString &rStr)
Definition: weld.hxx:929
virtual int find_text(const OUString &rStr) const override
Definition: weld.hxx:1784
void connect_value_changed(const Link< SpinButton &, void > &rLink)
Definition: weld.hxx:1665
sal_uInt16 nPos
virtual void set_sensitive(bool sensitive)=0
Link< render_args, void > m_aRenderHdl
Definition: weld.hxx:660
virtual void connect_mnemonic_activate(const Link< Widget &, bool > &rLink)
Definition: weld.hxx:234
Link< tools::Rectangle &, OUString > m_aQueryTooltipHdl
Definition: weld.hxx:2119
virtual bool has_entry() const override
Definition: weld.hxx:1801
bool signal_editing_done(const iter_string &rIterText)
Definition: weld.hxx:868