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