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_entry_font(const vcl::Font& rFont) = 0;
791  virtual vcl::Font get_entry_font() = 0;
792 
793  virtual bool get_popup_shown() const = 0;
794 
796  {
797  m_aEntryInsertTextHdl = rLink;
798  }
799 
800  // callback returns true to indicated no further processing of activate wanted
801  void connect_entry_activate(const Link<ComboBox&, bool>& rLink) { m_aEntryActivateHdl = rLink; }
802 
803  void save_value() { m_sSavedValue = get_active_text(); }
804  OUString const& get_saved_value() const { return m_sSavedValue; }
805  bool get_value_changed_from_saved() const { return m_sSavedValue != get_active_text(); }
806 
807  // for custom rendering a row
809  {
810  m_aGetSizeHdl = rLink;
811  }
812  void connect_custom_render(const Link<render_args, void>& rLink) { m_aRenderHdl = rLink; }
813  // call set_custom_renderer after setting custom callbacks
814  virtual void set_custom_renderer(bool bOn) = 0;
815  // create a virtual device compatible with the device passed in render_args wrt alpha
816  virtual VclPtr<VirtualDevice> create_render_virtual_device() const = 0;
817  // set a sub menu for a entry, only works with custom rendering
818  virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) = 0;
819  // get the width needed to show the menu launcher in a custom row
820  virtual int get_menu_button_width() const = 0;
821 
822  // for mru support
823  virtual int get_max_mru_count() const = 0;
824  virtual void set_max_mru_count(int nCount) = 0;
825  virtual OUString get_mru_entries() const = 0;
826  virtual void set_mru_entries(const OUString& rEntries) = 0;
827 };
828 
830 {
831  Check,
832  Radio
833 };
834 
836 {
837 private:
838  TreeIter(const TreeIter&) = delete;
839  TreeIter& operator=(const TreeIter&) = delete;
840 
841 public:
842  TreeIter() {}
843  virtual bool equal(const TreeIter& rOther) const = 0;
844  virtual ~TreeIter() {}
845 };
846 
847 /* Model column indexes are considered to begin at 0, but with special columns
848  before index 0. A expander image column (and an additional optional toggle
849  button column when enable_toggle_buttons is used). Column index -1 is
850  reserved to access those columns.
851 */
852 class VCL_DLLPUBLIC TreeView : virtual public Widget
853 {
854  friend class ::LOKTrigger;
855 
856 public:
857  typedef std::pair<const TreeIter&, int> iter_col;
858  typedef std::pair<const TreeIter&, OUString> iter_string;
859  // OUString is the id of the row, it may be null to measure the height of a generic line
860  typedef std::pair<vcl::RenderContext&, const OUString&> get_size_args;
861  typedef std::tuple<vcl::RenderContext&, const tools::Rectangle&, bool, const OUString&>
863 
864 private:
865  OUString m_sSavedValue;
866 
867 protected:
874  // if handler returns false, the expansion of the row is refused
876  // if handler returns false, the collapse of the row is refused
880  // if handler returns true, then menu has been show and event is consumed
882  // if handler returns true, drag is disallowed, consumer can change bool
883  // arg to false to disable the treeview default dnd icon
885  std::function<int(const weld::TreeIter&, const weld::TreeIter&)> m_aCustomSort;
886 
887 protected:
888  void signal_changed() { m_aChangeHdl.Call(*this); }
889  bool signal_row_activated() { return m_aRowActivatedHdl.Call(*this); }
890  void signal_column_clicked(int nColumn) { m_aColumnClickedHdl.Call(nColumn); }
891  bool signal_expanding(const TreeIter& rIter)
892  {
893  return !m_aExpandingHdl.IsSet() || m_aExpandingHdl.Call(rIter);
894  }
895  bool signal_collapsing(const TreeIter& rIter)
896  {
897  return !m_aCollapsingHdl.IsSet() || m_aCollapsingHdl.Call(rIter);
898  }
899  void signal_visible_range_changed() { m_aVisibleRangeChangedHdl.Call(*this); }
900  void signal_model_changed() { m_aModelChangedHdl.Call(*this); }
901 
902  void signal_toggled(const iter_col& rIterCol) { m_aRadioToggleHdl.Call(rIterCol); }
903 
904  bool signal_editing_started(const TreeIter& rIter) { return m_aEditingStartedHdl.Call(rIter); }
905 
906  bool signal_editing_done(const iter_string& rIterText)
907  {
908  return m_aEditingDoneHdl.Call(rIterText);
909  }
910 
912  OUString signal_query_tooltip(const TreeIter& rIter) { return m_aQueryTooltipHdl.Call(rIter); }
913 
916  bool bSelected, const OUString& rId)
917  {
918  m_aRenderHdl.Call(render_args(rDevice, rRect, bSelected, rId));
919  }
920 
922  Size signal_custom_get_size(vcl::RenderContext& rDevice, const OUString& rId)
923  {
924  return m_aGetSizeHdl.Call(get_size_args(rDevice, rId));
925  }
926 
927 public:
929  {
930  assert(!m_aQueryTooltipHdl.IsSet() || !rLink.IsSet());
931  m_aQueryTooltipHdl = rLink;
932  }
933 
934  // see 'expanding on-demand node details' for bChildrenOnDemand of true
935  virtual void insert(const TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
936  const OUString* pIconName, VirtualDevice* pImageSurface,
937  bool bChildrenOnDemand, TreeIter* pRet)
938  = 0;
939 
940  void insert(int nRow, TreeIter* pRet = nullptr)
941  {
942  insert(nullptr, nRow, nullptr, nullptr, nullptr, nullptr, false, pRet);
943  }
944 
945  void append(TreeIter* pRet = nullptr) { insert(-1, pRet); }
946 
947  void insert(int pos, const OUString& rStr, const OUString* pId, const OUString* pIconName,
948  VirtualDevice* pImageSurface)
949  {
950  insert(nullptr, pos, &rStr, pId, pIconName, pImageSurface, false, nullptr);
951  }
952  void insert_text(int pos, const OUString& rStr)
953  {
954  insert(nullptr, pos, &rStr, nullptr, nullptr, nullptr, false, nullptr);
955  }
956  void append_text(const OUString& rStr)
957  {
958  insert(nullptr, -1, &rStr, nullptr, nullptr, nullptr, false, nullptr);
959  }
960  void append(const OUString& rId, const OUString& rStr)
961  {
962  insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, false, nullptr);
963  }
964  void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
965  {
966  insert(nullptr, -1, &rStr, &rId, &rImage, nullptr, false, nullptr);
967  }
968  void append(const TreeIter* pParent, const OUString& rStr)
969  {
970  insert(pParent, -1, &rStr, nullptr, nullptr, nullptr, false, nullptr);
971  }
972 
973  virtual void insert_separator(int pos, const OUString& rId) = 0;
974  void append_separator(const OUString& rId) { insert_separator(-1, rId); }
975 
976  void connect_changed(const Link<TreeView&, void>& rLink) { m_aChangeHdl = rLink; }
977 
978  /* A row is "activated" when the user double clicks a treeview row. It may
979  also be emitted when a row is selected and Space or Enter is pressed.
980 
981  a return of "true" means the activation has been handled, a "false" propagates
982  the activation to the default handler which expands/collapses the row, if possible.
983  */
984  void connect_row_activated(const Link<TreeView&, bool>& rLink) { m_aRowActivatedHdl = rLink; }
985 
986  // Argument is a pair of iter, col describing the toggled node
987  void connect_toggled(const Link<const iter_col&, void>& rLink) { m_aRadioToggleHdl = rLink; }
988 
989  void connect_column_clicked(const Link<int, void>& rLink) { m_aColumnClickedHdl = rLink; }
990  void connect_model_changed(const Link<TreeView&, void>& rLink) { m_aModelChangedHdl = rLink; }
991 
992  virtual OUString get_selected_text() const = 0;
993  virtual OUString get_selected_id() const = 0;
994 
995  // call before inserting any content and connecting to toggle signals,
996  // an pre-inserted checkbutton column will exist at the start of every row
997  // inserted after this call which can be accessed with col index -1
998  virtual void enable_toggle_buttons(ColumnToggleType eType) = 0;
999 
1000  virtual void set_clicks_to_toggle(int nToggleBehavior) = 0;
1001 
1002  //by index
1003  virtual int get_selected_index() const = 0;
1004  //Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1005  virtual void select(int pos) = 0;
1006  virtual void unselect(int pos) = 0;
1007  virtual void remove(int pos) = 0;
1008  // col index -1 gets the first text column
1009  virtual OUString get_text(int row, int col = -1) const = 0;
1010  // col index -1 sets the first text column
1011  virtual void set_text(int row, const OUString& rText, int col = -1) = 0;
1012  // col index -1 sets the first text column
1013  virtual void set_sensitive(int row, bool bSensitive, int col = -1) = 0;
1014  virtual void set_id(int row, const OUString& rId) = 0;
1015  // col index -1 sets the expander toggle, enable_toggle_buttons must have been called to create that column
1016  virtual void set_toggle(int row, TriState eState, int col = -1) = 0;
1017  // col index -1 gets the expander toggle, enable_toggle_buttons must have been called to create that column
1018  virtual TriState get_toggle(int row, int col = -1) const = 0;
1019  // col index -1 sets the expander image
1020  virtual void set_image(int row, const OUString& rImage, int col = -1) = 0;
1021  // col index -1 sets the expander image
1022  virtual void set_image(int row, VirtualDevice& rImage, int col = -1) = 0;
1023  // col index -1 sets the expander image
1024  virtual void set_image(int row, const css::uno::Reference<css::graphic::XGraphic>& rImage,
1025  int col = -1)
1026  = 0;
1027  virtual void set_text_emphasis(int row, bool bOn, int col) = 0;
1028  virtual bool get_text_emphasis(int row, int col) const = 0;
1029  virtual void set_text_align(int row, double fAlign, int col) = 0;
1030  virtual void swap(int pos1, int pos2) = 0;
1031  virtual std::vector<int> get_selected_rows() const = 0;
1032  virtual void set_font_color(int pos, const Color& rColor) = 0;
1033  // scroll to make 'row' visible, this will also expand all parent rows of 'row' as necessary to
1034  // make 'row' visible
1035  virtual void scroll_to_row(int row) = 0;
1036  virtual bool is_selected(int pos) const = 0;
1037  virtual int get_cursor_index() const = 0;
1038  virtual void set_cursor(int pos) = 0;
1039 
1040  //by text
1041  virtual int find_text(const OUString& rText) const = 0;
1042  //Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1043  void select_text(const OUString& rText) { select(find_text(rText)); }
1044  void remove_text(const OUString& rText) { remove(find_text(rText)); }
1045  std::vector<OUString> get_selected_rows_text() const
1046  {
1047  std::vector<int> aRows(get_selected_rows());
1048  std::vector<OUString> aRet;
1049  aRet.reserve(aRows.size());
1050  for (auto a : aRows)
1051  aRet.push_back(get_text(a));
1052  return aRet;
1053  }
1054 
1055  //by id
1056  virtual OUString get_id(int pos) const = 0;
1057  virtual int find_id(const OUString& rId) const = 0;
1058  //Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1059  void select_id(const OUString& rId) { select(find_id(rId)); }
1060  void remove_id(const OUString& rText) { remove(find_id(rText)); }
1061 
1062  //via iter
1063  virtual std::unique_ptr<TreeIter> make_iterator(const TreeIter* pOrig = nullptr) const = 0;
1064  virtual void copy_iterator(const TreeIter& rSource, TreeIter& rDest) const = 0;
1065  virtual bool get_selected(TreeIter* pIter) const = 0;
1066  virtual bool get_cursor(TreeIter* pIter) const = 0;
1067  virtual void set_cursor(const TreeIter& rIter) = 0;
1068  virtual bool get_iter_first(TreeIter& rIter) const = 0;
1069  // set iter to point to next node at the current level
1070  virtual bool iter_next_sibling(TreeIter& rIter) const = 0;
1071  // set iter to point to previous node at the current level
1072  virtual bool iter_previous_sibling(TreeIter& rIter) const = 0;
1073  // set iter to point to next node, depth first, then sibling
1074  virtual bool iter_next(TreeIter& rIter) const = 0;
1075  // set iter to point to previous node, sibling first then depth
1076  virtual bool iter_previous(TreeIter& rIter) const = 0;
1077  // set iter to point to first child node
1078  virtual bool iter_children(TreeIter& rIter) const = 0;
1079  bool iter_nth_sibling(TreeIter& rIter, int nChild) const
1080  {
1081  bool bRet = true;
1082  for (int i = 0; i < nChild && bRet; ++i)
1083  bRet = iter_next_sibling(rIter);
1084  return bRet;
1085  }
1086  bool iter_nth_child(TreeIter& rIter, int nChild) const
1087  {
1088  if (!iter_children(rIter))
1089  return false;
1090  return iter_nth_sibling(rIter, nChild);
1091  }
1092  virtual bool iter_parent(TreeIter& rIter) const = 0;
1093  virtual int get_iter_depth(const TreeIter& rIter) const = 0;
1094  virtual int get_iter_index_in_parent(const TreeIter& rIter) const = 0;
1095  /* Compares two paths. If a appears before b in a tree, then -1 is returned.
1096  If b appears before a , then 1 is returned. If the two nodes are equal,
1097  then 0 is returned.
1098  */
1099  virtual int iter_compare(const TreeIter& a, const TreeIter& b) const = 0;
1100  virtual bool iter_has_child(const TreeIter& rIter) const = 0;
1101  // returns the number of direct children rIter has
1102  virtual int iter_n_children(const TreeIter& rIter) const = 0;
1103  virtual void remove(const TreeIter& rIter) = 0;
1104  //Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1105  virtual void select(const TreeIter& rIter) = 0;
1106  virtual void unselect(const TreeIter& rIter) = 0;
1107  //visually indent this row as if it was at get_iter_depth() + nIndentLevel
1108  virtual void set_extra_row_indent(const TreeIter& rIter, int nIndentLevel) = 0;
1109  // col index -1 sets the first text column
1110  virtual void set_text(const TreeIter& rIter, const OUString& rStr, int col = -1) = 0;
1111  // col index -1 sets the first text column
1112  virtual void set_sensitive(const TreeIter& rIter, bool bSensitive, int col = -1) = 0;
1113  virtual void set_text_emphasis(const TreeIter& rIter, bool bOn, int col) = 0;
1114  virtual bool get_text_emphasis(const TreeIter& rIter, int col) const = 0;
1115  virtual void set_text_align(const TreeIter& rIter, double fAlign, int col) = 0;
1116  // col index -1 sets the expander toggle, enable_toggle_buttons must have been called to create that column
1117  virtual void set_toggle(const TreeIter& rIter, TriState bOn, int col = -1) = 0;
1118  // col index -1 gets the expander toggle, enable_toggle_buttons must have been called to create that column
1119  virtual TriState get_toggle(const TreeIter& rIter, int col = -1) const = 0;
1120  // col index -1 gets the first text column
1121  virtual OUString get_text(const TreeIter& rIter, int col = -1) const = 0;
1122  virtual void set_id(const TreeIter& rIter, const OUString& rId) = 0;
1123  virtual OUString get_id(const TreeIter& rIter) const = 0;
1124  // col index -1 sets the expander image
1125  virtual void set_image(const TreeIter& rIter, const OUString& rImage, int col = -1) = 0;
1126  // col index -1 sets the expander image
1127  virtual void set_image(const TreeIter& rIter, VirtualDevice& rImage, int col = -1) = 0;
1128  // col index -1 sets the expander image
1129  virtual void set_image(const TreeIter& rIter,
1130  const css::uno::Reference<css::graphic::XGraphic>& rImage, int col = -1)
1131  = 0;
1132  virtual void set_font_color(const TreeIter& rIter, const Color& rColor) = 0;
1133  // scroll to make rIter visible, this will also expand all parent rows of rIter as necessary to
1134  // make rIter visible
1135  virtual void scroll_to_row(const TreeIter& rIter) = 0;
1136  virtual bool is_selected(const TreeIter& rIter) const = 0;
1137 
1138  virtual void move_subtree(TreeIter& rNode, const TreeIter* pNewParent, int nIndexInNewParent)
1139  = 0;
1140 
1141  // call func on each element until func returns true or we run out of elements
1142  virtual void all_foreach(const std::function<bool(TreeIter&)>& func) = 0;
1143  // call func on each selected element until func returns true or we run out of elements
1144  virtual void selected_foreach(const std::function<bool(TreeIter&)>& func) = 0;
1145  // call func on each visible element until func returns true or we run out of elements
1146  virtual void visible_foreach(const std::function<bool(TreeIter&)>& func) = 0;
1147  // clear the children of pParent (whole tree if nullptr),
1148  // then add nSourceCount rows under pParent, call func on each row
1149  // inserted with an arg of the index that this row will be when bulk insert
1150  // ends.
1151  //
1152  // this enables inserting the entries backwards in models where that is faster,
1153  //
1154  // pFixedWidths is optional, when present each matching entry col text
1155  // width will not be measured, and the fixed width used instead. Use
1156  // sparingly because wider text than the fixed width is clipped and cannot
1157  // be scrolled into view horizontally.
1158  virtual void bulk_insert_for_each(int nSourceCount,
1159  const std::function<void(TreeIter&, int nSourceIndex)>& func,
1160  const weld::TreeIter* pParent = nullptr,
1161  const std::vector<int>* pFixedWidths = nullptr)
1162  = 0;
1163 
1164  /* expanding on-demand node details
1165 
1166  When a node is added with children-on-demand (typically via 'insert' with
1167  bChildrenOnDemand of true), then initially in reality the
1168  children-on-demand node is given a 'placeholder' child entry to indicate
1169  the load-on-demand state.
1170 
1171  The 'placeholder' needs to be there for the expander indicator to be
1172  drawn/shown even when there are no "real" entries yet. This child doesn't
1173  exist for the purposes of any of the iterator methods, e.g. iter_has_child
1174  on an on-demand node which hasn't been expanded yet is false. Likewise the
1175  rest of the iterator methods skip over or otherwise ignore that node.
1176 
1177  Normal usage is the user clicks on the expander, the expansion mechanism
1178  removes the 'placeholder' entry (set_children_on_demand(false)) and calls
1179  any installed expanding-callback (installable via connect_expanding) which
1180  has the opportunity to populate the node with children.
1181 
1182  If you decide to directly populate the children of an on-demand node
1183  outside of the expanding-callback then you also need to explicitly remove
1184  the 'placeholder' with set_children_on_demand(false) otherwise the treeview
1185  is in an inconsistent state. */
1186 
1187  virtual bool get_row_expanded(const TreeIter& rIter) const = 0;
1188  // expand row will first trigger the callback set via connect_expanding before expanding
1189  virtual void expand_row(const TreeIter& rIter) = 0;
1190  // collapse row will first trigger the callback set via connect_collapsing before collapsing
1191  virtual void collapse_row(const TreeIter& rIter) = 0;
1192  // set the empty node to appear as if it has children, true is equivalent
1193  // to 'insert' with a bChildrenOnDemand of true. See notes above.
1194  virtual void set_children_on_demand(const TreeIter& rIter, bool bChildrenOnDemand) = 0;
1195  // return if the node is configured to be populated on-demand
1196  virtual bool get_children_on_demand(const TreeIter& rIter) const = 0;
1197  // set if the expanders are shown or not
1198  virtual void set_show_expanders(bool bShow) = 0;
1199 
1200  void connect_expanding(const Link<const TreeIter&, bool>& rLink) { m_aExpandingHdl = rLink; }
1201  void connect_collapsing(const Link<const TreeIter&, bool>& rLink) { m_aCollapsingHdl = rLink; }
1202 
1203  // rStartLink returns true to allow editing, false to disallow
1204  // rEndLink returns true to accept the edit, false to reject
1205  virtual void connect_editing(const Link<const TreeIter&, bool>& rStartLink,
1206  const Link<const iter_string&, bool>& rEndLink)
1207  {
1208  assert(rStartLink.IsSet() == rEndLink.IsSet() && "should be both on or both off");
1209  m_aEditingStartedHdl = rStartLink;
1210  m_aEditingDoneHdl = rEndLink;
1211  }
1212 
1213  virtual void start_editing(const weld::TreeIter& rEntry) = 0;
1214  virtual void end_editing() = 0;
1215 
1217  {
1218  assert(!m_aVisibleRangeChangedHdl.IsSet() || !rLink.IsSet());
1219  m_aVisibleRangeChangedHdl = rLink;
1220  }
1221 
1223  {
1224  m_aPopupMenuHdl = rLink;
1225  }
1226 
1227  virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rTransferrable,
1228  sal_uInt8 eDNDConstants)
1229  = 0;
1230 
1231  void connect_drag_begin(const Link<bool&, bool>& rLink) { m_aDragBeginHdl = rLink; }
1232 
1233  //all of them. Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1234  void select_all() { unselect(-1); }
1235  void unselect_all() { select(-1); }
1236 
1237  // return the number of toplevel nodes
1238  virtual int n_children() const = 0;
1239 
1240  // afterwards, entries will be in default ascending sort order
1241  virtual void make_sorted() = 0;
1242  virtual void make_unsorted() = 0;
1243  virtual bool get_sort_order() const = 0;
1244  virtual void set_sort_order(bool bAscending) = 0;
1245 
1246  // TRUE ascending, FALSE, descending, INDET, neither (off)
1247  virtual void set_sort_indicator(TriState eState, int nColumn) = 0;
1248  virtual TriState get_sort_indicator(int nColumn) const = 0;
1249 
1250  virtual int get_sort_column() const = 0;
1251  virtual void set_sort_column(int nColumn) = 0;
1252 
1253  virtual void
1254  set_sort_func(const std::function<int(const weld::TreeIter&, const weld::TreeIter&)>& func)
1255  {
1256  m_aCustomSort = func;
1257  }
1258 
1259  virtual void clear() = 0;
1260  virtual int get_height_rows(int nRows) const = 0;
1261 
1262  virtual void columns_autosize() = 0;
1263  virtual void set_column_fixed_widths(const std::vector<int>& rWidths) = 0;
1264  virtual void set_column_editables(const std::vector<bool>& rEditables) = 0;
1265  virtual int get_column_width(int nCol) const = 0;
1266  virtual void set_centered_column(int nCol) = 0;
1267  virtual OUString get_column_title(int nColumn) const = 0;
1268  virtual void set_column_title(int nColumn, const OUString& rTitle) = 0;
1269 
1270  int get_checkbox_column_width() const { return get_approximate_digit_width() * 3 + 6; }
1271 
1272  virtual void set_selection_mode(SelectionMode eMode) = 0;
1273  virtual int count_selected_rows() const = 0;
1274  // remove the selected nodes
1275  virtual void remove_selection() = 0;
1276 
1277  virtual void vadjustment_set_value(int value) = 0;
1278  virtual int vadjustment_get_value() const = 0;
1279 
1280  void save_value() { m_sSavedValue = get_selected_text(); }
1281  OUString const& get_saved_value() const { return m_sSavedValue; }
1282  bool get_value_changed_from_saved() const { return m_sSavedValue != get_selected_text(); }
1283 
1284  // for custom rendering a cell
1285  void connect_custom_get_size(const Link<get_size_args, Size>& rLink) { m_aGetSizeHdl = rLink; }
1286  void connect_custom_render(const Link<render_args, void>& rLink) { m_aRenderHdl = rLink; }
1287  // call set_column_custom_renderer after setting custom callbacks
1288  virtual void set_column_custom_renderer(int nColumn, bool bEnable) = 0;
1289  // redraw all rows, typically only useful with custom rendering to redraw due to external
1290  // state change
1291  virtual void queue_draw() = 0;
1292 
1293  /* with bDnDMode false simply return the row under the point
1294  *
1295  * with bDnDMode true:
1296  * a) return the row which should be dropped on, which may
1297  * be different from the row the mouse is over in some backends where
1298  * positioning the mouse on the bottom half of a row indicates to drop
1299  * after the row
1300  * b) dnd highlight the dest row
1301  */
1302  virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult, bool bDnDMode) = 0;
1303  virtual void unset_drag_dest_row() = 0;
1304  virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const = 0;
1305  // for dragging and dropping between TreeViews, return the active source
1306  virtual TreeView* get_drag_source() const = 0;
1307 
1308  using Widget::set_sensitive;
1309 };
1310 
1311 class VCL_DLLPUBLIC IconView : virtual public Widget
1312 {
1313  friend class ::LOKTrigger;
1314 
1315 private:
1316  OUString m_sSavedValue;
1317 
1318 protected:
1322 
1323  void signal_selection_changed() { m_aSelectionChangeHdl.Call(*this); }
1324  bool signal_item_activated() { return m_aItemActivatedHdl.Call(*this); }
1325 
1326 public:
1327  virtual void insert(int pos, const OUString* pStr, const OUString* pId,
1328  const OUString* pIconName, TreeIter* pRet)
1329  = 0;
1330 
1331  virtual void insert(int pos, const OUString* pStr, const OUString* pId,
1332  const VirtualDevice* pIcon, TreeIter* pRet)
1333  = 0;
1334 
1335  void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
1336  {
1337  insert(-1, &rStr, &rId, &rImage, nullptr);
1338  }
1339 
1340  void append(const OUString& rId, const OUString& rStr, const VirtualDevice* pImage)
1341  {
1342  insert(-1, &rStr, &rId, pImage, nullptr);
1343  }
1344 
1346  {
1347  m_aSelectionChangeHdl = rLink;
1348  }
1349 
1350  /* A row is "activated" when the user double clicks a treeview row. It may
1351  also be emitted when a row is selected and Space or Enter is pressed.
1352 
1353  a return of "true" means the activation has been handled, a "false" propagates
1354  the activation to the default handler which expands/collapses the row, if possible.
1355  */
1356  void connect_item_activated(const Link<IconView&, bool>& rLink) { m_aItemActivatedHdl = rLink; }
1357 
1358  void connect_command(const Link<const CommandEvent&, bool>& rLink) { m_aCommandHdl = rLink; }
1359 
1360  virtual OUString get_selected_id() const = 0;
1361 
1362  virtual void clear() = 0;
1363 
1364  virtual int count_selected_items() const = 0;
1365 
1366  virtual OUString get_selected_text() const = 0;
1367 
1368  //by index. Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1369  virtual void select(int pos) = 0;
1370  virtual void unselect(int pos) = 0;
1371 
1372  //via iter
1373  virtual std::unique_ptr<TreeIter> make_iterator(const TreeIter* pOrig = nullptr) const = 0;
1374  virtual bool get_selected(TreeIter* pIter) const = 0;
1375  virtual bool get_cursor(TreeIter* pIter) const = 0;
1376  virtual void set_cursor(const TreeIter& rIter) = 0;
1377  virtual bool get_iter_first(TreeIter& rIter) const = 0;
1378  virtual OUString get_id(const TreeIter& rIter) const = 0;
1379  virtual void scroll_to_item(const TreeIter& rIter) = 0;
1380 
1381  // call func on each selected element until func returns true or we run out of elements
1382  virtual void selected_foreach(const std::function<bool(TreeIter&)>& func) = 0;
1383 
1384  //all of them. Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
1385  void select_all() { unselect(-1); }
1386  void unselect_all() { select(-1); }
1387 
1388  // return the number of toplevel nodes
1389  virtual int n_children() const = 0;
1390 
1391  void save_value() { m_sSavedValue = get_selected_text(); }
1392  OUString const& get_saved_value() const { return m_sSavedValue; }
1393  bool get_value_changed_from_saved() const { return m_sSavedValue != get_selected_text(); }
1394 };
1395 
1396 class VCL_DLLPUBLIC Button : virtual public Widget
1397 {
1398  friend class ::LOKTrigger;
1399 
1400 protected:
1402 
1403  void signal_clicked() { m_aClickHdl.Call(*this); }
1404 
1405 public:
1406  virtual void set_label(const OUString& rText) = 0;
1407  // pDevice, the image for the button, or nullptr to unset
1408  virtual void set_image(VirtualDevice* pDevice) = 0;
1409  virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) = 0;
1410  virtual void set_from_icon_name(const OUString& rIconName) = 0;
1411  virtual OUString get_label() const = 0;
1412  void clicked() { signal_clicked(); }
1413 
1414  // font size is in points, not pixels, e.g. see Window::[G]etPointFont
1415  virtual void set_font(const vcl::Font& rFont) = 0;
1416 
1417  /* Sometimes, a widget should behave like a button (activate on click,
1418  accept keyboard focus, etc), but look entirely different.
1419 
1420  pDevice, the custom look to use, or nullptr to unset.
1421 
1422  Typically doing this is ill advised. Consider using
1423  set_accessible_name if you do. */
1424  virtual void set_custom_button(VirtualDevice* pDevice) = 0;
1425 
1426  void connect_clicked(const Link<Button&, void>& rLink) { m_aClickHdl = rLink; }
1427 };
1428 
1429 class VCL_DLLPUBLIC Toggleable : virtual public Widget
1430 {
1431  friend class ::LOKTrigger;
1432 
1433 protected:
1435  TriState m_eSavedValue = TRISTATE_FALSE;
1436 
1437  void signal_toggled() { m_aToggleHdl.Call(*this); }
1438 
1439 public:
1440  virtual void set_active(bool active) = 0;
1441  virtual bool get_active() const = 0;
1442 
1443  virtual void set_inconsistent(bool inconsistent) = 0;
1444  virtual bool get_inconsistent() const = 0;
1445 
1447  {
1448  if (get_inconsistent())
1449  return TRISTATE_INDET;
1450  else if (get_active())
1451  return TRISTATE_TRUE;
1452  return TRISTATE_FALSE;
1453  }
1454 
1455  void set_state(TriState eState)
1456  {
1457  switch (eState)
1458  {
1459  case TRISTATE_INDET:
1460  set_inconsistent(true);
1461  break;
1462  case TRISTATE_TRUE:
1463  set_inconsistent(false);
1464  set_active(true);
1465  break;
1466  case TRISTATE_FALSE:
1467  set_inconsistent(false);
1468  set_active(false);
1469  break;
1470  }
1471  }
1472 
1473  void save_state() { m_eSavedValue = get_state(); }
1474  TriState get_saved_state() const { return m_eSavedValue; }
1475  bool get_state_changed_from_saved() const { return m_eSavedValue != get_state(); }
1476 
1477  virtual void connect_toggled(const Link<Toggleable&, void>& rLink) { m_aToggleHdl = rLink; }
1478 };
1479 
1480 class VCL_DLLPUBLIC ToggleButton : virtual public Button, virtual public Toggleable
1481 {
1482  friend class ::LOKTrigger;
1483 };
1484 
1486 {
1490  : eState(TRISTATE_INDET)
1491  , bTriStateEnabled(true)
1492  {
1493  }
1494  void ButtonToggled(Toggleable& rToggle);
1495 };
1496 
1497 class VCL_DLLPUBLIC MenuButton : virtual public ToggleButton
1498 {
1499 protected:
1501 
1502  void signal_selected(const OString& rIdent) { m_aSelectHdl.Call(rIdent); }
1503 
1504 public:
1505  void connect_selected(const Link<const OString&, void>& rLink) { m_aSelectHdl = rLink; }
1506 
1507  virtual void insert_item(int pos, const OUString& rId, const OUString& rStr,
1508  const OUString* pIconName, VirtualDevice* pImageSurface,
1509  TriState eCheckRadioFalse)
1510  = 0;
1511  void append_item(const OUString& rId, const OUString& rStr)
1512  {
1513  insert_item(-1, rId, rStr, nullptr, nullptr, TRISTATE_INDET);
1514  }
1515  void append_item_check(const OUString& rId, const OUString& rStr)
1516  {
1517  insert_item(-1, rId, rStr, nullptr, nullptr, TRISTATE_TRUE);
1518  }
1519  void append_item_radio(const OUString& rId, const OUString& rStr)
1520  {
1521  insert_item(-1, rId, rStr, nullptr, nullptr, TRISTATE_FALSE);
1522  }
1523  void append_item(const OUString& rId, const OUString& rStr, const OUString& rImage)
1524  {
1525  insert_item(-1, rId, rStr, &rImage, nullptr, TRISTATE_INDET);
1526  }
1527  void append_item(const OUString& rId, const OUString& rStr, VirtualDevice& rImage)
1528  {
1529  insert_item(-1, rId, rStr, nullptr, &rImage, TRISTATE_INDET);
1530  }
1531  virtual void insert_separator(int pos, const OUString& rId) = 0;
1532  void append_separator(const OUString& rId) { insert_separator(-1, rId); }
1533  virtual void remove_item(const OString& rId) = 0;
1534  virtual void clear() = 0;
1535  virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) = 0;
1536  virtual void set_item_active(const OString& rIdent, bool bActive) = 0;
1537  virtual void set_item_label(const OString& rIdent, const OUString& rLabel) = 0;
1538  virtual OUString get_item_label(const OString& rIdent) const = 0;
1539  virtual void set_item_visible(const OString& rIdent, bool bVisible) = 0;
1540 
1541  virtual void set_popover(weld::Widget* pPopover) = 0;
1542 };
1543 
1544 // Similar to a MenuButton except it is split into two parts, a toggle
1545 // button at the start and a menubutton at the end
1547 {
1548 };
1549 
1550 class VCL_DLLPUBLIC CheckButton : virtual public Toggleable
1551 {
1552 public:
1553  virtual void set_label(const OUString& rText) = 0;
1554  virtual OUString get_label() const = 0;
1555  virtual void set_label_wrap(bool wrap) = 0;
1556 };
1557 
1558 class VCL_DLLPUBLIC RadioButton : virtual public CheckButton
1559 {
1560 };
1561 
1562 class VCL_DLLPUBLIC LinkButton : virtual public Widget
1563 {
1564 protected:
1566 
1567  bool signal_activate_link() { return m_aActivateLinkHdl.Call(*this); }
1568 
1569 public:
1570  virtual void set_label(const OUString& rText) = 0;
1571  virtual OUString get_label() const = 0;
1572  virtual void set_uri(const OUString& rUri) = 0;
1573  virtual OUString get_uri() const = 0;
1574 
1575  void connect_activate_link(const Link<LinkButton&, bool>& rLink) { m_aActivateLinkHdl = rLink; }
1576 };
1577 
1578 class VCL_DLLPUBLIC Scale : virtual public Widget
1579 {
1580 protected:
1582 
1583  void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
1584 
1585 public:
1586  virtual void set_value(int value) = 0;
1587  virtual int get_value() const = 0;
1588  virtual void set_range(int min, int max) = 0;
1589 
1590  virtual void set_increments(int step, int page) = 0;
1591  virtual void get_increments(int& step, int& page) const = 0;
1592 
1593  void connect_value_changed(const Link<Scale&, void>& rLink) { m_aValueChangedHdl = rLink; }
1594 };
1595 
1596 class VCL_DLLPUBLIC Spinner : virtual public Widget
1597 {
1598 public:
1599  virtual void start() = 0;
1600  virtual void stop() = 0;
1601 };
1602 
1603 class VCL_DLLPUBLIC ProgressBar : virtual public Widget
1604 {
1605 public:
1606  //0-100
1607  virtual void set_percentage(int value) = 0;
1608  virtual OUString get_text() const = 0;
1609  virtual void set_text(const OUString& rText) = 0;
1610 };
1611 
1612 class VCL_DLLPUBLIC Entry : virtual public Widget
1613 {
1614 private:
1615  OUString m_sSavedValue;
1616 
1617 protected:
1622 
1623  friend class ::LOKTrigger;
1624 
1625  void signal_changed() { m_aChangeHdl.Call(*this); }
1626  void signal_cursor_position() { m_aCursorPositionHdl.Call(*this); }
1627 
1628 public:
1629  virtual void set_text(const OUString& rText) = 0;
1630  virtual OUString get_text() const = 0;
1631  virtual void set_width_chars(int nChars) = 0;
1632  virtual int get_width_chars() const = 0;
1633  // The maximum length of the entry. Use 0 for no maximum
1634  virtual void set_max_length(int nChars) = 0;
1635  // nEndPos can be -1 in order to select all text
1636  virtual void select_region(int nStartPos, int nEndPos) = 0;
1637  // returns true if the selection has nonzero length
1638  virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0;
1639  virtual void replace_selection(const OUString& rText) = 0;
1640  // nCursorPos can be -1 to set to the end
1641  virtual void set_position(int nCursorPos) = 0;
1642  virtual int get_position() const = 0;
1643  virtual void set_editable(bool bEditable) = 0;
1644  virtual bool get_editable() const = 0;
1645  virtual void set_message_type(EntryMessageType eType) = 0;
1646  virtual void set_placeholder_text(const OUString& rText) = 0;
1647 
1648  virtual void set_overwrite_mode(bool bOn) = 0;
1649  virtual bool get_overwrite_mode() const = 0;
1650 
1651  // font size is in points, not pixels, e.g. see Window::[G]etPointFont
1652  virtual void set_font(const vcl::Font& rFont) = 0;
1653 
1654  /*
1655  If you want to set a warning or error state, see set_message_type
1656  instead where, if the toolkit supports it, a specific warning/error
1657  indicator is shown.
1658 
1659  This explicit text color method exists to support rendering the
1660  SvNumberformat color feature.
1661  */
1662  virtual void set_font_color(const Color& rColor) = 0;
1663 
1664  virtual void connect_changed(const Link<Entry&, void>& rLink) { m_aChangeHdl = rLink; }
1665  void connect_insert_text(const Link<OUString&, bool>& rLink) { m_aInsertTextHdl = rLink; }
1666  // callback returns true to indicated no further processing of activate wanted
1667  void connect_activate(const Link<Entry&, bool>& rLink) { m_aActivateHdl = rLink; }
1668  virtual void connect_cursor_position(const Link<Entry&, void>& rLink)
1669  {
1670  m_aCursorPositionHdl = rLink;
1671  }
1672 
1673  virtual void cut_clipboard() = 0;
1674  virtual void copy_clipboard() = 0;
1675  virtual void paste_clipboard() = 0;
1676 
1677  virtual void set_alignment(TxtAlign eXAlign) = 0;
1678 
1679  void save_value() { m_sSavedValue = get_text(); }
1680  OUString const& get_saved_value() const { return m_sSavedValue; }
1681  bool get_value_changed_from_saved() const { return m_sSavedValue != get_text(); }
1682 };
1683 
1684 class VCL_DLLPUBLIC SpinButton : virtual public Entry
1685 {
1686  friend class ::LOKTrigger;
1687 
1688 protected:
1692 
1693  void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
1694 
1696  {
1697  if (!m_aOutputHdl.IsSet())
1698  return false;
1699  m_aOutputHdl.Call(*this);
1700  return true;
1701  }
1702 
1703  TriState signal_input(int* result)
1704  {
1705  if (!m_aInputHdl.IsSet())
1706  return TRISTATE_INDET;
1707  return m_aInputHdl.Call(result) ? TRISTATE_TRUE : TRISTATE_FALSE;
1708  }
1709 
1710 public:
1711  virtual void set_value(int value) = 0;
1712  virtual int get_value() const = 0;
1713  virtual void set_range(int min, int max) = 0;
1714  virtual void get_range(int& min, int& max) const = 0;
1715  void set_min(int min)
1716  {
1717  int dummy, max;
1718  get_range(dummy, max);
1719  set_range(min, max);
1720  }
1721  void set_max(int max)
1722  {
1723  int min, dummy;
1724  get_range(min, dummy);
1725  set_range(min, max);
1726  }
1727  int get_min() const
1728  {
1729  int min, dummy;
1730  get_range(min, dummy);
1731  return min;
1732  }
1733  int get_max() const
1734  {
1735  int dummy, max;
1736  get_range(dummy, max);
1737  return max;
1738  }
1739  virtual void set_increments(int step, int page) = 0;
1740  virtual void get_increments(int& step, int& page) const = 0;
1741  virtual void set_digits(unsigned int digits) = 0;
1742  virtual unsigned int get_digits() const = 0;
1743 
1744  void connect_value_changed(const Link<SpinButton&, void>& rLink) { m_aValueChangedHdl = rLink; }
1745 
1746  void connect_output(const Link<SpinButton&, void>& rLink) { m_aOutputHdl = rLink; }
1747  void connect_input(const Link<int*, bool>& rLink) { m_aInputHdl = rLink; }
1748 
1749  int normalize(int nValue) const { return (nValue * Power10(get_digits())); }
1750 
1751  int denormalize(int nValue) const;
1752 
1753  static unsigned int Power10(unsigned int n);
1754 };
1755 
1756 class EntryFormatter;
1757 
1758 // Similar to a SpinButton, but input and output formatting and range/value
1759 // are managed by a more complex Formatter which can support doubles.
1761 {
1762 protected:
1764 
1765  void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
1766 
1767 public:
1768  virtual Formatter& GetFormatter() = 0;
1769  // does not take ownership, and so must be deregistered if pFormatter
1770  // is destroyed
1771  virtual void SetFormatter(weld::EntryFormatter* pFormatter) = 0;
1772 
1774  {
1775  m_aValueChangedHdl = rLink;
1776  }
1777 
1778 private:
1779  friend class EntryFormatter;
1780  virtual void sync_range_from_formatter() = 0;
1781  virtual void sync_value_from_formatter() = 0;
1782  virtual void sync_increments_from_formatter() = 0;
1783 };
1784 
1785 class VCL_DLLPUBLIC Image : virtual public Widget
1786 {
1787 public:
1788  virtual void set_from_icon_name(const OUString& rIconName) = 0;
1789  virtual void set_image(VirtualDevice* pDevice) = 0;
1790  virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) = 0;
1791 };
1792 
1793 class VCL_DLLPUBLIC Calendar : virtual public Widget
1794 {
1795 protected:
1798 
1799  void signal_selected() { m_aSelectedHdl.Call(*this); }
1800  void signal_activated() { m_aActivatedHdl.Call(*this); }
1801 
1802 public:
1803  void connect_selected(const Link<Calendar&, void>& rLink) { m_aSelectedHdl = rLink; }
1804  void connect_activated(const Link<Calendar&, void>& rLink) { m_aActivatedHdl = rLink; }
1805 
1806  virtual void set_date(const Date& rDate) = 0;
1807  virtual Date get_date() const = 0;
1808 };
1809 
1810 // an entry + treeview pair, where the entry autocompletes from the
1811 // treeview list, and selecting something in the list sets the
1812 // entry to that text, i.e. a visually exploded ComboBox
1813 class VCL_DLLPUBLIC EntryTreeView : virtual public ComboBox
1814 {
1815 private:
1816  DECL_DLLPRIVATE_LINK(ClickHdl, weld::TreeView&, void);
1817  DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
1818  void EntryModifyHdl(const weld::Entry& rEntry);
1819 
1820 protected:
1821  std::unique_ptr<Entry> m_xEntry;
1822  std::unique_ptr<TreeView> m_xTreeView;
1823 
1824 public:
1825  EntryTreeView(std::unique_ptr<Entry> xEntry, std::unique_ptr<TreeView> xTreeView);
1826 
1827  virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems,
1828  bool bKeepExisting) override
1829  {
1830  m_xTreeView->freeze();
1831  if (!bKeepExisting)
1832  m_xTreeView->clear();
1833  for (const auto& rItem : rItems)
1834  {
1835  m_xTreeView->insert(-1, rItem.sString, rItem.sId.isEmpty() ? nullptr : &rItem.sId,
1836  rItem.sImage.isEmpty() ? nullptr : &rItem.sImage, nullptr);
1837  }
1838  m_xTreeView->thaw();
1839  }
1840 
1841  virtual void insert(int pos, const OUString& rStr, const OUString* pId,
1842  const OUString* pIconName, VirtualDevice* pImageSurface) override
1843  {
1844  m_xTreeView->insert(pos, rStr, pId, pIconName, pImageSurface);
1845  }
1846 
1847  virtual int get_count() const override { return m_xTreeView->n_children(); }
1848  virtual void clear() override { m_xTreeView->clear(); }
1849 
1850  //by index
1851  virtual int get_active() const override { return m_xTreeView->get_selected_index(); }
1852  virtual void set_active(int pos) override
1853  {
1854  m_xTreeView->set_cursor(pos);
1855  m_xTreeView->select(pos);
1856  m_xEntry->set_text(m_xTreeView->get_selected_text());
1857  }
1858  virtual void remove(int pos) override { m_xTreeView->remove(pos); }
1859 
1860  //by text
1861  virtual OUString get_active_text() const override { return m_xEntry->get_text(); }
1862  virtual OUString get_text(int pos) const override { return m_xTreeView->get_text(pos); }
1863  virtual int find_text(const OUString& rStr) const override
1864  {
1865  return m_xTreeView->find_text(rStr);
1866  }
1867 
1868  //by id
1869  virtual OUString get_active_id() const override { return m_xTreeView->get_selected_id(); }
1870  virtual void set_active_id(const OUString& rStr) override
1871  {
1872  m_xTreeView->select_id(rStr);
1873  m_xEntry->set_text(m_xTreeView->get_selected_text());
1874  }
1875  virtual OUString get_id(int pos) const override { return m_xTreeView->get_id(pos); }
1876  virtual void set_id(int pos, const OUString& rId) override { m_xTreeView->set_id(pos, rId); }
1877  virtual int find_id(const OUString& rId) const override { return m_xTreeView->find_id(rId); }
1878 
1879  //entry related
1880  virtual bool has_entry() const override { return true; }
1881  virtual void set_entry_message_type(EntryMessageType eType) override
1882  {
1883  m_xEntry->set_message_type(eType);
1884  }
1885  virtual void set_entry_text(const OUString& rStr) override { m_xEntry->set_text(rStr); }
1886  virtual void set_entry_width_chars(int nChars) override { m_xEntry->set_width_chars(nChars); }
1887  virtual void set_entry_max_length(int nChars) override { m_xEntry->set_max_length(nChars); }
1888  virtual void select_entry_region(int nStartPos, int nEndPos) override
1889  {
1890  m_xEntry->select_region(nStartPos, nEndPos);
1891  }
1892  //if no text was selected, both rStartPos and rEndPos will be identical
1893  //and false will be returned
1894  virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) override
1895  {
1896  return m_xEntry->get_selection_bounds(rStartPos, rEndPos);
1897  }
1899  {
1900  m_xTreeView->connect_row_activated(rLink);
1901  }
1902 
1903  virtual bool get_popup_shown() const override { return false; }
1904 
1905  void set_height_request_by_rows(int nRows);
1906 };
1907 
1909 {
1911  std::unique_ptr<weld::SpinButton> m_xSpinButton;
1913 
1914  DECL_LINK(spin_button_value_changed, weld::SpinButton&, void);
1915  DECL_LINK(spin_button_output, weld::SpinButton&, void);
1916  DECL_LINK(spin_button_input, int* result, bool);
1917 
1918  void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
1919 
1920  int ConvertValue(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit) const;
1921  OUString format_number(int nValue) const;
1922  void update_width_chars();
1923 
1924 public:
1925  MetricSpinButton(std::unique_ptr<SpinButton> pSpinButton, FieldUnit eSrcUnit)
1926  : m_eSrcUnit(eSrcUnit)
1927  , m_xSpinButton(std::move(pSpinButton))
1928  {
1929  update_width_chars();
1930  m_xSpinButton->connect_output(LINK(this, MetricSpinButton, spin_button_output));
1931  m_xSpinButton->connect_input(LINK(this, MetricSpinButton, spin_button_input));
1932  m_xSpinButton->connect_value_changed(
1933  LINK(this, MetricSpinButton, spin_button_value_changed));
1934  spin_button_output(*m_xSpinButton);
1935  }
1936 
1937  static OUString MetricToString(FieldUnit rUnit);
1938 
1939  FieldUnit get_unit() const { return m_eSrcUnit; }
1940 
1941  void set_unit(FieldUnit eUnit);
1942 
1943  int convert_value_to(int nValue, FieldUnit eValueUnit) const
1944  {
1945  return ConvertValue(nValue, m_eSrcUnit, eValueUnit);
1946  }
1947 
1948  int convert_value_from(int nValue, FieldUnit eValueUnit) const
1949  {
1950  return ConvertValue(nValue, eValueUnit, m_eSrcUnit);
1951  }
1952 
1953  void set_value(int nValue, FieldUnit eValueUnit)
1954  {
1955  m_xSpinButton->set_value(convert_value_from(nValue, eValueUnit));
1956  }
1957 
1958  int get_value(FieldUnit eDestUnit) const
1959  {
1960  return convert_value_to(m_xSpinButton->get_value(), eDestUnit);
1961  }
1962 
1963  // typically you only need to call this if set_text (e.g. with "") was
1964  // previously called to display some arbitrary text instead of the
1965  // formatted value and now you want to show it as formatted again
1966  void reformat() { spin_button_output(*m_xSpinButton); }
1967 
1968  void set_range(int min, int max, FieldUnit eValueUnit)
1969  {
1970  min = convert_value_from(min, eValueUnit);
1971  max = convert_value_from(max, eValueUnit);
1972  m_xSpinButton->set_range(min, max);
1973  update_width_chars();
1974  }
1975 
1976  void get_range(int& min, int& max, FieldUnit eDestUnit) const
1977  {
1978  m_xSpinButton->get_range(min, max);
1979  min = convert_value_to(min, eDestUnit);
1980  max = convert_value_to(max, eDestUnit);
1981  }
1982 
1983  void set_min(int min, FieldUnit eValueUnit)
1984  {
1985  int dummy, max;
1986  get_range(dummy, max, eValueUnit);
1987  set_range(min, max, eValueUnit);
1988  }
1989 
1990  void set_max(int max, FieldUnit eValueUnit)
1991  {
1992  int min, dummy;
1993  get_range(min, dummy, eValueUnit);
1994  set_range(min, max, eValueUnit);
1995  }
1996 
1997  int get_min(FieldUnit eValueUnit) const
1998  {
1999  int min, dummy;
2000  get_range(min, dummy, eValueUnit);
2001  return min;
2002  }
2003 
2004  int get_max(FieldUnit eValueUnit) const
2005  {
2006  int dummy, max;
2007  get_range(dummy, max, eValueUnit);
2008  return max;
2009  }
2010 
2011  void set_increments(int step, int page, FieldUnit eValueUnit)
2012  {
2013  step = convert_value_from(step, eValueUnit);
2014  page = convert_value_from(page, eValueUnit);
2015  m_xSpinButton->set_increments(step, page);
2016  }
2017 
2018  void get_increments(int& step, int& page, FieldUnit eDestUnit) const
2019  {
2020  m_xSpinButton->get_increments(step, page);
2021  step = convert_value_to(step, eDestUnit);
2022  page = convert_value_to(page, eDestUnit);
2023  }
2024 
2026  {
2027  m_aValueChangedHdl = rLink;
2028  }
2029 
2030  int normalize(int nValue) const { return m_xSpinButton->normalize(nValue); }
2031  int denormalize(int nValue) const { return m_xSpinButton->denormalize(nValue); }
2032  void set_sensitive(bool sensitive) { m_xSpinButton->set_sensitive(sensitive); }
2033  bool get_sensitive() const { return m_xSpinButton->get_sensitive(); }
2034  bool get_visible() const { return m_xSpinButton->get_visible(); }
2035  void grab_focus() { m_xSpinButton->grab_focus(); }
2036  bool has_focus() const { return m_xSpinButton->has_focus(); }
2037  void show() { m_xSpinButton->show(); }
2038  void set_visible(bool bShow) { m_xSpinButton->set_visible(bShow); }
2039  void hide() { m_xSpinButton->hide(); }
2040  void set_digits(unsigned int digits);
2041  void set_accessible_name(const OUString& rName) { m_xSpinButton->set_accessible_name(rName); }
2042  unsigned int get_digits() const { return m_xSpinButton->get_digits(); }
2043  void save_value() { m_xSpinButton->save_value(); }
2045  {
2046  return m_xSpinButton->get_value_changed_from_saved();
2047  }
2048  void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); }
2049  OUString get_text() const { return m_xSpinButton->get_text(); }
2050  void set_size_request(int nWidth, int nHeight)
2051  {
2052  m_xSpinButton->set_size_request(nWidth, nHeight);
2053  }
2054  Size get_size_request() const { return m_xSpinButton->get_size_request(); }
2055  Size get_preferred_size() const { return m_xSpinButton->get_preferred_size(); }
2057  {
2058  m_xSpinButton->connect_focus_in(rLink);
2059  }
2061  {
2062  m_xSpinButton->connect_focus_out(rLink);
2063  }
2064  OString get_buildable_name() const { return m_xSpinButton->get_buildable_name(); }
2065  void set_help_id(const OString& rName) { m_xSpinButton->set_help_id(rName); }
2066  void set_position(int nCursorPos) { m_xSpinButton->set_position(nCursorPos); }
2067  // set the width of the underlying widget in characters, this setting is
2068  // invalidated when changing the units, range or digits, so to have effect
2069  // must come after changing those values
2070  void set_width_chars(int nChars) { m_xSpinButton->set_width_chars(nChars); }
2071  int get_width_chars() const { return m_xSpinButton->get_width_chars(); }
2072  weld::SpinButton& get_widget() { return *m_xSpinButton; }
2073 };
2074 
2075 enum class LabelType
2076 {
2077  Normal,
2078  Warning,
2079  Error,
2080  Title, // this is intended to be used against the background set by set_title_background
2081 };
2082 
2083 class VCL_DLLPUBLIC Label : virtual public Widget
2084 {
2085 public:
2086  virtual void set_label(const OUString& rText) = 0;
2087  virtual OUString get_label() const = 0;
2088  virtual void set_mnemonic_widget(Widget* pTarget) = 0;
2089  // font size is in points, not pixels, e.g. see Window::[G]etPointFont
2090  virtual void set_font(const vcl::Font& rFont) = 0;
2091  virtual void set_label_type(LabelType eType) = 0;
2092  /*
2093  If you want to set a warning or error state, see set_label_type
2094  instead.
2095  */
2096  virtual void set_font_color(const Color& rColor) = 0;
2097 };
2098 
2099 class VCL_DLLPUBLIC TextView : virtual public Widget
2100 {
2101  friend class ::LOKTrigger;
2102 
2103 private:
2104  OUString m_sSavedValue;
2105 
2106 protected:
2110 
2111  void signal_changed() { m_aChangeHdl.Call(*this); }
2112  void signal_cursor_position() { m_aCursorPositionHdl.Call(*this); }
2113  void signal_vadjustment_changed() { m_aVChangeHdl.Call(*this); }
2114 
2115 public:
2116  virtual void set_text(const OUString& rText) = 0;
2117  virtual OUString get_text() const = 0;
2118  // if nStartPos or nEndPos is -1 the max available text pos will be used
2119  virtual void select_region(int nStartPos, int nEndPos) = 0;
2120  // returns true if the selection has nonzero length
2121  virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0;
2122  virtual void replace_selection(const OUString& rText) = 0;
2123  virtual void set_editable(bool bEditable) = 0;
2124  virtual bool get_editable() const = 0;
2125  virtual void set_monospace(bool bMonospace) = 0;
2126  // The maximum length of the entry. Use 0 for no maximum
2127  virtual void set_max_length(int nChars) = 0;
2128  int get_height_rows(int nRows) const
2129  {
2130  //can improve this if needed
2131  return get_text_height() * nRows;
2132  }
2133 
2134  /*
2135  Typically you want to avoid the temptation of customizing
2136  font colors
2137  */
2138  virtual void set_font_color(const Color& rColor) = 0;
2139 
2140  void save_value() { m_sSavedValue = get_text(); }
2141  bool get_value_changed_from_saved() const { return m_sSavedValue != get_text(); }
2142 
2143  void connect_changed(const Link<TextView&, void>& rLink) { m_aChangeHdl = rLink; }
2145  {
2146  m_aCursorPositionHdl = rLink;
2147  }
2148 
2149  // returns true if pressing up would move the cursor
2150  // doesn't matter if that move is to a previous line or to the start of the
2151  // current line just so long as the cursor would move
2152  virtual bool can_move_cursor_with_up() const = 0;
2153 
2154  // returns true if pressing down would move the cursor
2155  // doesn't matter if that move is to a next line or to the end of the
2156  // current line just so long as the cursor would move
2157  virtual bool can_move_cursor_with_down() const = 0;
2158 
2159  virtual void cut_clipboard() = 0;
2160  virtual void copy_clipboard() = 0;
2161  virtual void paste_clipboard() = 0;
2162 
2163  virtual void set_alignment(TxtAlign eXAlign) = 0;
2164 
2165  virtual int vadjustment_get_value() const = 0;
2166  virtual int vadjustment_get_upper() const = 0;
2167  virtual int vadjustment_get_lower() const = 0;
2168  virtual int vadjustment_get_page_size() const = 0;
2169  virtual void vadjustment_set_value(int value) = 0;
2170  void connect_vadjustment_changed(const Link<TextView&, void>& rLink) { m_aVChangeHdl = rLink; }
2171 };
2172 
2173 class VCL_DLLPUBLIC Expander : virtual public Widget
2174 {
2175 protected:
2177 
2178  void signal_expanded() { m_aExpandedHdl.Call(*this); }
2179 
2180 public:
2181  virtual void set_label(const OUString& rText) = 0;
2182  virtual OUString get_label() const = 0;
2183  virtual bool get_expanded() const = 0;
2184  virtual void set_expanded(bool bExpand) = 0;
2185 
2186  void connect_expanded(const Link<Expander&, void>& rLink) { m_aExpandedHdl = rLink; }
2187 };
2188 
2189 class VCL_DLLPUBLIC DrawingArea : virtual public Widget
2190 {
2191 public:
2192  typedef std::pair<vcl::RenderContext&, const tools::Rectangle&> draw_args;
2193 
2194 protected:
2200  // if handler returns true, drag is disallowed
2202  // return position of cursor, fill OUString& with surrounding text
2204  // attempt to delete the range, return true if successful
2206 
2208  {
2209  return m_aQueryTooltipHdl.Call(rHelpArea);
2210  }
2211 
2212  int signal_im_context_get_surrounding(OUString& rSurroundingText)
2213  {
2214  if (!m_aGetSurroundingHdl.IsSet())
2215  return -1;
2216  return m_aGetSurroundingHdl.Call(rSurroundingText);
2217  }
2218 
2220  {
2221  return m_aDeleteSurroundingHdl.Call(rRange);
2222  }
2223 
2224 public:
2225  void connect_draw(const Link<draw_args, void>& rLink) { m_aDrawHdl = rLink; }
2226  void connect_style_updated(const Link<Widget&, void>& rLink) { m_aStyleUpdatedHdl = rLink; }
2227  void connect_command(const Link<const CommandEvent&, bool>& rLink) { m_aCommandHdl = rLink; }
2229  {
2230  m_aGetFocusRectHdl = rLink;
2231  }
2233  {
2234  m_aQueryTooltipHdl = rLink;
2235  }
2236  void connect_drag_begin(const Link<DrawingArea&, bool>& rLink) { m_aDragBeginHdl = rLink; }
2238  {
2239  m_aGetSurroundingHdl = rLink;
2240  }
2242  {
2243  m_aDeleteSurroundingHdl = rLink;
2244  }
2245  virtual void queue_draw() = 0;
2246  virtual void queue_draw_area(int x, int y, int width, int height) = 0;
2247 
2248  virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rTransferrable,
2249  sal_uInt8 eDNDConstants)
2250  = 0;
2251 
2252  virtual void set_cursor(PointerStyle ePointerStyle) = 0;
2253 
2254  virtual Point get_pointer_position() const = 0;
2255 
2256  virtual void set_input_context(const InputContext& rInputContext) = 0;
2257  virtual void im_context_set_cursor_location(const tools::Rectangle& rCursorRect,
2258  int nExtTextInputWidth)
2259  = 0;
2260 
2261  // use return here just to generate matching VirtualDevices
2262  virtual OutputDevice& get_ref_device() = 0;
2263 
2264  virtual a11yref get_accessible_parent() = 0;
2265  virtual a11yrelationset get_accessible_relation_set() = 0;
2266  virtual Point get_accessible_location_on_screen() = 0;
2267 
2268 private:
2269  friend class ::LOKTrigger;
2270 
2271  virtual void click(const Point& rPos) = 0;
2272 };
2273 
2275 {
2276 protected:
2278 
2279  void signal_activate(const OString& rIdent) { m_aActivateHdl.Call(rIdent); }
2280 
2281 public:
2282  virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) = 0;
2283 
2284  void connect_activate(const Link<const OString&, void>& rLink) { m_aActivateHdl = rLink; }
2285 
2286  virtual void set_sensitive(const OString& rIdent, bool bSensitive) = 0;
2287  virtual bool get_sensitive(const OString& rIdent) const = 0;
2288  virtual void set_label(const OString& rIdent, const OUString& rLabel) = 0;
2289  virtual OUString get_label(const OString& rIdent) const = 0;
2290  virtual void set_active(const OString& rIdent, bool bActive) = 0;
2291  virtual bool get_active(const OString& rIdent) const = 0;
2292  virtual void set_visible(const OString& rIdent, bool bVisible) = 0;
2293 
2294  virtual void insert(int pos, const OUString& rId, const OUString& rStr,
2295  const OUString* pIconName, VirtualDevice* pImageSurface,
2296  const css::uno::Reference<css::graphic::XGraphic>& rImage,
2297  TriState eCheckRadioFalse)
2298  = 0;
2299 
2300  virtual void remove(const OString& rId) = 0;
2301 
2302  virtual void clear() = 0;
2303 
2304  virtual void insert_separator(int pos, const OUString& rId) = 0;
2305  void append_separator(const OUString& rId) { insert_separator(-1, rId); }
2306 
2307  void append(const OUString& rId, const OUString& rStr)
2308  {
2309  insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_INDET);
2310  }
2311  void append_check(const OUString& rId, const OUString& rStr)
2312  {
2313  insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_TRUE);
2314  }
2315  void append_radio(const OUString& rId, const OUString& rStr)
2316  {
2317  insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_FALSE);
2318  }
2319  void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
2320  {
2321  insert(-1, rId, rStr, &rImage, nullptr, nullptr, TRISTATE_INDET);
2322  }
2323  void append(const OUString& rId, const OUString& rStr, VirtualDevice& rImage)
2324  {
2325  insert(-1, rId, rStr, nullptr, &rImage, nullptr, TRISTATE_INDET);
2326  }
2327 
2328  // return the number of toplevel nodes
2329  virtual int n_children() const = 0;
2330 
2331  virtual OString get_id(int pos) const = 0;
2332 
2333  virtual ~Menu() {}
2334 };
2335 
2336 class VCL_DLLPUBLIC Popover : virtual public Container
2337 {
2338 private:
2340 
2341 protected:
2342  void signal_closed() { m_aCloseHdl.Call(*this); }
2343 
2344 public:
2345  virtual void popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) = 0;
2346  virtual void popdown() = 0;
2347 
2348  void connect_closed(const Link<weld::Popover&, void>& rLink) { m_aCloseHdl = rLink; }
2349 };
2350 
2351 class VCL_DLLPUBLIC Toolbar : virtual public Widget
2352 {
2353 protected:
2356 
2357  friend class ::LOKTrigger;
2358 
2359  void signal_clicked(const OString& rIdent) { m_aClickHdl.Call(rIdent); }
2360  void signal_toggle_menu(const OString& rIdent) { m_aToggleMenuHdl.Call(rIdent); }
2361 
2362 public:
2363  virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) = 0;
2364  virtual bool get_item_sensitive(const OString& rIdent) const = 0;
2365  virtual void set_item_active(const OString& rIdent, bool bActive) = 0;
2366  virtual bool get_item_active(const OString& rIdent) const = 0;
2367  virtual void set_menu_item_active(const OString& rIdent, bool bActive) = 0;
2368  virtual bool get_menu_item_active(const OString& rIdent) const = 0;
2369  virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) = 0;
2370  virtual void set_item_popover(const OString& rIdent, weld::Widget* pPopover) = 0;
2371  virtual void set_item_visible(const OString& rIdent, bool bVisible) = 0;
2372  virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) = 0;
2373  virtual bool get_item_visible(const OString& rIdent) const = 0;
2374  virtual void set_item_label(const OString& rIdent, const OUString& rLabel) = 0;
2375  virtual OUString get_item_label(const OString& rIdent) const = 0;
2376  virtual void set_item_tooltip_text(const OString& rIdent, const OUString& rTip) = 0;
2377  virtual OUString get_item_tooltip_text(const OString& rIdent) const = 0;
2378  virtual void set_item_icon_name(const OString& rIdent, const OUString& rIconName) = 0;
2379  virtual void set_item_image(const OString& rIdent,
2380  const css::uno::Reference<css::graphic::XGraphic>& rIcon)
2381  = 0;
2382  virtual void set_item_image(const OString& rIdent, VirtualDevice* pDevice) = 0;
2383 
2384  virtual void insert_item(int pos, const OUString& rId) = 0;
2385  virtual void insert_separator(int pos, const OUString& rId) = 0;
2386  void append_separator(const OUString& rId) { insert_separator(-1, rId); }
2387 
2388  virtual int get_n_items() const = 0;
2389  virtual OString get_item_ident(int nIndex) const = 0;
2390  virtual void set_item_ident(int nIndex, const OString& rIdent) = 0;
2391  virtual void set_item_label(int nIndex, const OUString& rLabel) = 0;
2392  virtual void set_item_image(int nIndex,
2393  const css::uno::Reference<css::graphic::XGraphic>& rIcon)
2394  = 0;
2395  virtual void set_item_tooltip_text(int nIndex, const OUString& rTip) = 0;
2396 
2397  virtual vcl::ImageType get_icon_size() const = 0;
2398  virtual void set_icon_size(vcl::ImageType eType) = 0;
2399 
2400  // return what modifiers are held
2401  virtual sal_uInt16 get_modifier_state() const = 0;
2402 
2403  // This function returns the position a new item should be inserted if dnd
2404  // is dropped at rPoint
2405  virtual int get_drop_index(const Point& rPoint) const = 0;
2406 
2407  void connect_clicked(const Link<const OString&, void>& rLink) { m_aClickHdl = rLink; }
2408  void connect_menu_toggled(const Link<const OString&, void>& rLink) { m_aToggleMenuHdl = rLink; }
2409 };
2410 
2412 {
2413 public:
2414  virtual void add_widget(weld::Widget* pWidget) = 0;
2415  // the default mode is VclSizeGroupMode::Horizontal
2416  virtual void set_mode(VclSizeGroupMode eMode) = 0;
2417  virtual ~SizeGroup() {}
2418 };
2419 
2421 {
2422 public:
2423  virtual std::unique_ptr<MessageDialog> weld_message_dialog(const OString& id) = 0;
2424  virtual std::unique_ptr<Dialog> weld_dialog(const OString& id) = 0;
2425  virtual std::unique_ptr<Assistant> weld_assistant(const OString& id) = 0;
2426  virtual std::unique_ptr<Widget> weld_widget(const OString& id) = 0;
2427  virtual std::unique_ptr<Container> weld_container(const OString& id) = 0;
2428  virtual std::unique_ptr<Box> weld_box(const OString& id) = 0;
2429  virtual std::unique_ptr<Paned> weld_paned(const OString& id) = 0;
2430  virtual std::unique_ptr<Button> weld_button(const OString& id) = 0;
2431  virtual std::unique_ptr<MenuButton> weld_menu_button(const OString& id) = 0;
2432  virtual std::unique_ptr<MenuToggleButton> weld_menu_toggle_button(const OString& id) = 0;
2433  virtual std::unique_ptr<Frame> weld_frame(const OString& id) = 0;
2434  /* bUserManagedScrolling of true means that the automatic scrolling of the window is disabled
2435  and the owner must specifically listen to adjustment changes and react appropriately to them.
2436  */
2437  virtual std::unique_ptr<ScrolledWindow> weld_scrolled_window(const OString& id,
2438  bool bUserManagedScrolling = false)
2439  = 0;
2440  virtual std::unique_ptr<Notebook> weld_notebook(const OString& id) = 0;
2441  virtual std::unique_ptr<ToggleButton> weld_toggle_button(const OString& id) = 0;
2442  virtual std::unique_ptr<RadioButton> weld_radio_button(const OString& id) = 0;
2443  virtual std::unique_ptr<CheckButton> weld_check_button(const OString& id) = 0;
2444  virtual std::unique_ptr<LinkButton> weld_link_button(const OString& id) = 0;
2445  virtual std::unique_ptr<SpinButton> weld_spin_button(const OString& id) = 0;
2446  virtual std::unique_ptr<MetricSpinButton> weld_metric_spin_button(const OString& id,
2447  FieldUnit eUnit)
2448  = 0;
2449  virtual std::unique_ptr<FormattedSpinButton> weld_formatted_spin_button(const OString& id) = 0;
2450  virtual std::unique_ptr<ComboBox> weld_combo_box(const OString& id) = 0;
2451  virtual std::unique_ptr<TreeView> weld_tree_view(const OString& id) = 0;
2452  virtual std::unique_ptr<IconView> weld_icon_view(const OString& id) = 0;
2453  virtual std::unique_ptr<Label> weld_label(const OString& id) = 0;
2454  virtual std::unique_ptr<TextView> weld_text_view(const OString& id) = 0;
2455  virtual std::unique_ptr<Expander> weld_expander(const OString& id) = 0;
2456  virtual std::unique_ptr<Entry> weld_entry(const OString& id) = 0;
2457  virtual std::unique_ptr<Scale> weld_scale(const OString& id) = 0;
2458  virtual std::unique_ptr<ProgressBar> weld_progress_bar(const OString& id) = 0;
2459  virtual std::unique_ptr<Spinner> weld_spinner(const OString& id) = 0;
2460  virtual std::unique_ptr<Image> weld_image(const OString& id) = 0;
2461  virtual std::unique_ptr<Calendar> weld_calendar(const OString& id) = 0;
2462  virtual std::unique_ptr<DrawingArea>
2463  weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
2464  FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = nullptr)
2465  = 0;
2466  virtual std::unique_ptr<EntryTreeView> weld_entry_tree_view(const OString& containerid,
2467  const OString& entryid,
2468  const OString& treeviewid)
2469  = 0;
2470  virtual std::unique_ptr<Menu> weld_menu(const OString& id) = 0;
2471  virtual std::unique_ptr<Popover> weld_popover(const OString& id) = 0;
2472  virtual std::unique_ptr<Toolbar> weld_toolbar(const OString& id) = 0;
2473  virtual std::unique_ptr<SizeGroup> create_size_group() = 0;
2474  /* return a Dialog suitable to take a screenshot of containing the contents of the .ui file.
2475 
2476  If the toplevel element is a dialog, that will be returned
2477  If the toplevel is not a dialog, a dialog will be created and the contents of the .ui
2478  inserted into it
2479  */
2480  virtual std::unique_ptr<Window> create_screenshot_window() = 0;
2481  virtual ~Builder() {}
2482 };
2483 
2484 class VCL_DLLPUBLIC DialogController : public std::enable_shared_from_this<DialogController>
2485 {
2486 public:
2487  virtual Dialog* getDialog() = 0;
2488  const Dialog* getConstDialog() const
2489  {
2490  return const_cast<DialogController*>(this)->getDialog();
2491  }
2492  virtual short run() { return getDialog()->run(); }
2493  static bool runAsync(const std::shared_ptr<DialogController>& rController,
2494  const std::function<void(sal_Int32)>&);
2495  void set_title(const OUString& rTitle) { getDialog()->set_title(rTitle); }
2496  OUString get_title() const { return getConstDialog()->get_title(); }
2497  void set_help_id(const OString& rHelpId) { getDialog()->set_help_id(rHelpId); }
2498  OString get_help_id() const { return getConstDialog()->get_help_id(); }
2499  void response(int nResponse) { getDialog()->response(nResponse); }
2500  virtual ~DialogController() COVERITY_NOEXCEPT_FALSE;
2501 };
2502 
2504 {
2505 protected:
2506  std::unique_ptr<weld::Builder> m_xBuilder;
2507  std::shared_ptr<weld::Dialog> m_xDialog;
2508 
2509 public:
2510  GenericDialogController(weld::Widget* pParent, const OUString& rUIFile,
2511  const OString& rDialogId, bool bMobile = false);
2512  virtual Dialog* getDialog() override;
2513  virtual ~GenericDialogController() COVERITY_NOEXCEPT_FALSE override;
2514 };
2515 
2516 class VCL_DLLPUBLIC MessageDialogController : public DialogController
2517 {
2518 protected:
2519  std::unique_ptr<weld::Builder> m_xBuilder;
2520  std::unique_ptr<weld::MessageDialog> m_xDialog;
2521  std::unique_ptr<weld::Container> m_xContentArea;
2522  std::unique_ptr<weld::Widget> m_xRelocate;
2523  std::unique_ptr<weld::Container> m_xOrigParent;
2524 
2525 public:
2526  /* @param rRelocateId - optional argument of the name of a widget in the .ui file
2527  which should be relocated into the content area of the dialog.
2528 
2529  e.g. a checkbox for a "Never show this again" option.
2530 
2531  This results in the named widget relocating to the same container
2532  as the messages. This enables aligning the extra widget with the
2533  message labels in the content area container which doesn't
2534  explicitly exist in the ui description, but is only implied.
2535  */
2536  MessageDialogController(weld::Widget* pParent, const OUString& rUIFile,
2537  const OString& rDialogId, const OString& rRelocateId = OString());
2538  virtual Dialog* getDialog() override;
2539  virtual ~MessageDialogController() override;
2540  void set_primary_text(const OUString& rText) { m_xDialog->set_primary_text(rText); }
2541  OUString get_primary_text() const { return m_xDialog->get_primary_text(); }
2542  void set_default_response(int nResponse) { m_xDialog->set_default_response(nResponse); }
2543 };
2544 
2545 class VCL_DLLPUBLIC AssistantController : public DialogController
2546 {
2547 protected:
2548  std::unique_ptr<weld::Builder> m_xBuilder;
2549  std::unique_ptr<weld::Assistant> m_xAssistant;
2550 
2551 public:
2552  AssistantController(weld::Widget* pParent, const OUString& rUIFile, const OString& rDialogId);
2553  virtual Dialog* getDialog() override;
2554  virtual ~AssistantController() override;
2555 };
2556 }
2557 #endif
2558 
2559 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void append_item_check(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:1515
OUString const & get_saved_value() const
Definition: weld.hxx:1392
Link< const Size &, void > m_aSizeAllocateHdl
Definition: weld.hxx:86
std::shared_ptr< weld::Dialog > m_xDialog
Definition: weld.hxx:2507
void remove_text(const OUString &rText)
Definition: weld.hxx:1044
void append(const OUString &rId, const OUString &rStr, VirtualDevice &rImage)
Definition: weld.hxx:2323
virtual void connect_changed(const Link< Entry &, void > &rLink)
Definition: weld.hxx:1664
void connect_activate_link(const Link< LinkButton &, bool > &rLink)
Definition: weld.hxx:1575
void set_size_request(int nWidth, int nHeight)
Definition: weld.hxx:2050
void connect_row_activated(const Link< TreeView &, bool > &rLink)
Definition: weld.hxx:1898
int get_min() const
Definition: weld.hxx:1727
FieldUnit
rEdit set_text(aStr)
virtual void set_sort_func(const std::function< int(const weld::TreeIter &, const weld::TreeIter &)> &func)
Definition: weld.hxx:1254
Link< const OString &, void > m_aClickHdl
Definition: weld.hxx:2354
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:839
OUString get_primary_text() const
Definition: weld.hxx:2541
virtual OUString get_text(int pos) const override
Definition: weld.hxx:1862
virtual void connect_focus_out(const Link< Widget &, void > &rLink)
Definition: weld.hxx:227
void set_title(const OUString &rTitle)
Definition: weld.hxx:2495
void signal_custom_render(vcl::RenderContext &rDevice, const tools::Rectangle &rRect, bool bSelected, const OUString &rId)
Definition: weld.hxx:915
OUString const & get_saved_value() const
Definition: weld.hxx:804
std::vector< OUString > get_selected_rows_text() const
Definition: weld.hxx:1045
void set_state(TriState eState)
Definition: weld.hxx:1455
void connect_im_context_get_surrounding(const Link< OUString &, int > &rLink)
Definition: weld.hxx:2237
Link< Button &, void > m_aClickHdl
Definition: weld.hxx:1401
int convert_value_to(int nValue, FieldUnit eValueUnit) const
Definition: weld.hxx:1943
const OString & GetHelpId() const
Definition: weld.hxx:498
void connect_column_clicked(const Link< int, void > &rLink)
Definition: weld.hxx:989
void append_separator(const OUString &rId)
Definition: weld.hxx:974
Link< Widget &, void > m_aFocusOutHdl
Definition: weld.hxx:84
std::unique_ptr< weld::Builder > m_xBuilder
Definition: weld.hxx:2506
void connect_entry_activate(const Link< ComboBox &, bool > &rLink)
Definition: weld.hxx:801
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:964
virtual void connect_editing(const Link< const TreeIter &, bool > &rStartLink, const Link< const iter_string &, bool > &rEndLink)
Definition: weld.hxx:1205
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:2226
void remove_id(const OUString &rText)
Definition: weld.hxx:1060
void unselect_all()
Definition: weld.hxx:1235
void append_page(const OString &rIdent, const OUString &rLabel)
Definition: weld.hxx:473
void signal_closed()
Definition: weld.hxx:2342
void signal_cursor_position()
Definition: weld.hxx:2112
void append_separator(const OUString &rId)
Definition: weld.hxx:732
Link< const CommandEvent &, bool > m_aPopupMenuHdl
Definition: weld.hxx:881
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
bool get_visible() const
Definition: weld.hxx:2034
void insert_text(int pos, const OUString &rStr)
Definition: weld.hxx:952
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:2104
bool get_value_changed_from_saved() const
Definition: weld.hxx:805
OUString m_sSavedValue
Definition: weld.hxx:865
void save_state()
Definition: weld.hxx:1473
Link< Calendar &, void > m_aSelectedHdl
Definition: weld.hxx:1796
virtual OUString get_id(int pos) const override
Definition: weld.hxx:1875
void append(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:960
virtual OUString get_active_text() const override
Definition: weld.hxx:1861
Link< Widget &, void > m_aStyleUpdatedHdl
Definition: weld.hxx:2196
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:987
virtual ~Builder()
Definition: weld.hxx:2481
std::unique_ptr< weld::Builder > m_xBuilder
Definition: weld.hxx:2519
void select_all()
Definition: weld.hxx:1385
void signal_container_focus_changed()
Definition: weld.hxx:354
std::unique_ptr< weld::Widget > m_xRelocate
Definition: weld.hxx:2522
virtual void set_active_id(const OUString &rStr) override
Definition: weld.hxx:1870
OUString get_text() const
Definition: weld.hxx:2049
Link< const Selection &, bool > m_aDeleteSurroundingHdl
Definition: weld.hxx:2205
int get_width_chars() const
Definition: weld.hxx:2071
SelectionMode
Definition: vclenum.hxx:26
virtual void clear() override
Definition: weld.hxx:1848
void connect_model_changed(const Link< TreeView &, void > &rLink)
Definition: weld.hxx:990
void connect_focus_rect(const Link< Widget &, tools::Rectangle > &rLink)
Definition: weld.hxx:2228
virtual void insert(int pos, const OUString &rStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface) override
Definition: weld.hxx:1841
Link< SpinButton &, void > m_aOutputHdl
Definition: weld.hxx:1690
Size signal_custom_get_size(vcl::RenderContext &rDevice, const OUString &rId)
Definition: weld.hxx:922
virtual void connect_visible_range_changed(const Link< TreeView &, void > &rLink)
Definition: weld.hxx:1216
int normalize(int nValue) const
Definition: weld.hxx:1749
Link< get_size_args, Size > m_aGetSizeHdl
Definition: weld.hxx:921
void signal_vadjustment_changed()
Definition: weld.hxx:398
void connect_insert_text(const Link< OUString &, bool > &rLink)
Definition: weld.hxx:1665
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:1619
void connect_custom_render(const Link< render_args, void > &rLink)
Definition: weld.hxx:1286
void append(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:2307
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:2192
void set_max(int max, FieldUnit eValueUnit)
Definition: weld.hxx:1990
weld::SpinButton & get_widget()
Definition: weld.hxx:2072
void signal_changed()
Definition: weld.hxx:2111
Link< const TreeIter &, bool > m_aCollapsingHdl
Definition: weld.hxx:877
TriState get_saved_state() const
Definition: weld.hxx:1474
Link< TextView &, void > m_aChangeHdl
Definition: weld.hxx:2107
void set_width_chars(int nChars)
Definition: weld.hxx:2070
virtual void connect_query_tooltip(const Link< const TreeIter &, OUString > &rLink)
Definition: weld.hxx:928
TRISTATE_TRUE
void get_range(int &min, int &max, FieldUnit eDestUnit) const
Definition: weld.hxx:1976
void connect_focus_out(const Link< Widget &, void > &rLink)
Definition: weld.hxx:2060
Link< TextView &, void > m_aCursorPositionHdl
Definition: weld.hxx:2109
void insert(int nRow, TreeIter *pRet=nullptr)
Definition: weld.hxx:940
MetricSpinButton(std::unique_ptr< SpinButton > pSpinButton, FieldUnit eSrcUnit)
Definition: weld.hxx:1925
Link< const CommandEvent &, bool > m_aCommandHdl
Definition: weld.hxx:2197
Link< Container &, void > m_aContainerFocusChangedHdl
Definition: weld.hxx:352
std::unique_ptr< weld::Builder > m_xBuilder
Definition: weld.hxx:2548
int normalize(int nValue) const
Definition: weld.hxx:2030
std::unique_ptr< weld::Container > m_xOrigParent
Definition: weld.hxx:2523
Link< IconView &, bool > m_aItemActivatedHdl
Definition: weld.hxx:1320
def position
void connect_selected(const Link< const OString &, void > &rLink)
Definition: weld.hxx:1505
WaitObject(weld::Widget *pWindow)
Definition: weld.hxx:562
Link< const OString &, void > m_aSelectHdl
Definition: weld.hxx:1500
void connect_value_changed(const Link< MetricSpinButton &, void > &rLink)
Definition: weld.hxx:2025
void connect_changed(const Link< TreeView &, void > &rLink)
Definition: weld.hxx:976
bool signal_jump_page(const OString &rIdent)
Definition: weld.hxx:623
void append_item(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:1511
int get_max(FieldUnit eValueUnit) const
Definition: weld.hxx:2004
void append(const OUString &rId, const OUString &rStr, const VirtualDevice *pImage)
Definition: weld.hxx:1340
#define min(a, b)
Link< IconView &, void > m_aSelectionChangeHdl
Definition: weld.hxx:1319
void append_text(const OUString &rStr)
Definition: weld.hxx:956
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:2018
void signal_clicked(const OString &rIdent)
Definition: weld.hxx:2359
void signal_vadjustment_changed()
Definition: weld.hxx:2113
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:857
Link< OUString &, bool > m_aEntryInsertTextHdl
Definition: weld.hxx:690
std::unique_ptr< weld::SpinButton > m_xSpinButton
Definition: weld.hxx:1911
virtual void connect_mouse_release(const Link< const MouseEvent &, bool > &rLink)
Definition: weld.hxx:272
LabelType
Definition: weld.hxx:2075
Link< vcl::RenderContext &, Size > m_aGetSizeHdl
Definition: weld.hxx:705
Link< TreeView &, void > m_aVisibleRangeChangedHdl
Definition: weld.hxx:878
VclSizeGroupMode
Definition: vclenum.hxx:263
OUString sImage
Definition: weld.hxx:648
void set_accessible_name(const OUString &rName)
Definition: weld.hxx:2041
Link< const iter_col &, void > m_aRadioToggleHdl
Definition: weld.hxx:871
void connect_selection_changed(const Link< IconView &, void > &rLink)
Definition: weld.hxx:1345
WindowStateMask
Definition: vclenum.hxx:121
void connect_custom_get_size(const Link< get_size_args, Size > &rLink)
Definition: weld.hxx:1285
void connect_entry_insert_text(const Link< OUString &, bool > &rLink)
Definition: weld.hxx:795
OUString sString
Definition: weld.hxx:646
Mode eMode
void signal_selected(const OString &rIdent)
Definition: weld.hxx:1502
bool signal_im_context_delete_surrounding(const Selection &rRange)
Definition: weld.hxx:2219
OUString signal_query_tooltip(const TreeIter &rIter)
Definition: weld.hxx:912
std::unique_ptr< TreeView > m_xTreeView
Definition: weld.hxx:1822
void save_value()
Definition: weld.hxx:1280
virtual ~Widget()
Definition: weld.hxx:346
def run
VclPolicyType
Definition: vclenum.hxx:271
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:2108
virtual void set_active(int pos) override
Definition: weld.hxx:1852
bool signal_collapsing(const TreeIter &rIter)
Definition: weld.hxx:895
Link< OUString &, int > m_aGetSurroundingHdl
Definition: weld.hxx:2203
TRISTATE_INDET
void set_position(int nCursorPos)
Definition: weld.hxx:2066
void signal_clicked()
Definition: weld.hxx:1403
void save_value()
Definition: weld.hxx:2140
basegfx::B2IRange maB2IRange
Definition: weld.hxx:502
void save_value()
Definition: weld.hxx:803
void connect_row_activated(const Link< TreeView &, bool > &rLink)
Definition: weld.hxx:984
virtual void connect_toggled(const Link< Toggleable &, void > &rLink)
Definition: weld.hxx:1477
Link< const TreeIter &, bool > m_aEditingStartedHdl
Definition: weld.hxx:872
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:2236
void set_text(const OUString &rText)
Definition: weld.hxx:2048
DocumentType eType
Link< draw_args, void > m_aDrawHdl
Definition: weld.hxx:2195
void connect_vadjustment_changed(const Link< TextView &, void > &rLink)
Definition: weld.hxx:2170
void connect_im_context_delete_surrounding(const Link< const Selection &, bool > &rLink)
Definition: weld.hxx:2241
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:1968
Size get_preferred_size() const
Definition: weld.hxx:2055
void connect_clicked(const Link< Button &, void > &rLink)
Definition: weld.hxx:1426
void set_active_text(const OUString &rStr)
Definition: weld.hxx:745
Link< MetricSpinButton &, void > m_aValueChangedHdl
Definition: weld.hxx:1912
void signal_expanded()
Definition: weld.hxx:2178
Link< TreeView &, void > m_aChangeHdl
Definition: weld.hxx:868
virtual int find_id(const OUString &rId) const override
Definition: weld.hxx:1877
virtual void insert_vector(const std::vector< weld::ComboBoxEntry > &rItems, bool bKeepExisting) override
Definition: weld.hxx:1827
Link< SpinButton &, void > m_aValueChangedHdl
Definition: weld.hxx:1689
void set_min(int min)
Definition: weld.hxx:1715
int i
bool get_value_changed_from_saved() const
Definition: weld.hxx:2141
void signal_activate(const OString &rIdent)
Definition: weld.hxx:2279
uno_Any a
virtual int get_count() const override
Definition: weld.hxx:1847
bool equal(T const &rfValA, T const &rfValB)
ImageType
Definition: vclenum.hxx:326
void connect_changed(const Link< ComboBox &, void > &rLink)
Definition: weld.hxx:765
bool signal_output()
Definition: weld.hxx:1695
virtual void connect_container_focus_changed(const Link< Container &, void > &rLink)
Definition: weld.hxx:366
void signal_changed()
Definition: weld.hxx:1625
void append_item(const OUString &rId, const OUString &rStr, VirtualDevice &rImage)
Definition: weld.hxx:1527
void unselect_all()
Definition: weld.hxx:1386
OUString const & get_saved_value() const
Definition: weld.hxx:1281
Link< Entry &, void > m_aCursorPositionHdl
Definition: weld.hxx:1620
virtual void connect_cursor_position(const Link< Entry &, void > &rLink)
Definition: weld.hxx:1668
void connect_expanding(const Link< const TreeIter &, bool > &rLink)
Definition: weld.hxx:1200
void connect_custom_get_size(const Link< vcl::RenderContext &, Size > &rLink)
Definition: weld.hxx:808
void append_item(const OUString &rId, const OUString &rStr, const OUString &rImage)
Definition: weld.hxx:1523
void signal_cursor_position()
Definition: weld.hxx:1626
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:844
void connect_selected(const Link< Calendar &, void > &rLink)
Definition: weld.hxx:1803
void connect_item_activated(const Link< IconView &, bool > &rLink)
Definition: weld.hxx:1356
std::unique_ptr< weld::Container > m_xContentArea
Definition: weld.hxx:2521
void append_radio(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:2315
void append(const OUString &rId, const OUString &rStr, const OUString &rImage)
Definition: weld.hxx:1335
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:162
void connect_command(const Link< const CommandEvent &, bool > &rLink)
Definition: weld.hxx:1358
void connect_leave_page(const Link< const OString &, bool > &rLink)
Definition: weld.hxx:482
void signal_model_changed()
Definition: weld.hxx:900
virtual void select_entry_region(int nStartPos, int nEndPos) override
Definition: weld.hxx:1888
Link< Entry &, void > m_aChangeHdl
Definition: weld.hxx:1618
virtual bool get_popup_shown() const override
Definition: weld.hxx:1903
Link< const OString &, void > m_aEnterPageHdl
Definition: weld.hxx:462
bool get_value_changed_from_saved() const
Definition: weld.hxx:1393
void signal_toggle_menu(const OString &rIdent)
Definition: weld.hxx:2360
Size get_size_request() const
Definition: weld.hxx:2054
void connect_jump_page(const Link< const OString &, bool > &rLink)
Definition: weld.hxx:641
Link< int, void > m_aColumnClickedHdl
Definition: weld.hxx:870
const basegfx::B2IRange & getB2IRange() const
Definition: weld.hxx:496
Link< Toggleable &, void > m_aToggleHdl
Definition: weld.hxx:1434
void connect_collapsing(const Link< const TreeIter &, bool > &rLink)
Definition: weld.hxx:1201
Link< bool &, bool > m_aDragBeginHdl
Definition: weld.hxx:884
void signal_changed()
Definition: weld.hxx:888
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:2333
void set_value(int nValue, FieldUnit eValueUnit)
Definition: weld.hxx:1953
void connect_value_changed(const Link< Scale &, void > &rLink)
Definition: weld.hxx:1593
void signal_selected()
Definition: weld.hxx:1799
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:2497
Link< ScrolledWindow &, void > m_aHChangeHdl
Definition: weld.hxx:396
OUString m_sSavedValue
Definition: weld.hxx:1316
Link< const KeyEvent &, bool > m_aKeyPressHdl
Definition: weld.hxx:87
void set_default_response(int nResponse)
Definition: weld.hxx:2542
void append_separator(const OUString &rId)
Definition: weld.hxx:1532
virtual int get_active() const override
Definition: weld.hxx:1851
virtual void connect_cursor_position(const Link< TextView &, void > &rLink)
Definition: weld.hxx:2144
bool get_sensitive() const
Definition: weld.hxx:2033
OUString m_sSavedValue
Definition: weld.hxx:679
int signal_im_context_get_surrounding(OUString &rSurroundingText)
Definition: weld.hxx:2212
Link< const MouseEvent &, bool > m_aMouseReleaseHdl
Definition: weld.hxx:91
Link< Widget &, tools::Rectangle > m_aGetFocusRectHdl
Definition: weld.hxx:2198
void signal_hadjustment_changed()
Definition: weld.hxx:399
void save_value()
Definition: weld.hxx:1391
Link< TreeView &, bool > m_aRowActivatedHdl
Definition: weld.hxx:869
bool get_value_changed_from_saved() const
Definition: weld.hxx:2044
bool signal_expanding(const TreeIter &rIter)
Definition: weld.hxx:891
virtual void set_busy_cursor(bool bBusy)=0
void connect_custom_render(const Link< render_args, void > &rLink)
Definition: weld.hxx:812
Link< Widget &, bool > m_aHelpRequestHdl
Definition: weld.hxx:510
bool has_focus() const
Definition: weld.hxx:2036
void connect_drag_begin(const Link< bool &, bool > &rLink)
Definition: weld.hxx:1231
virtual void connect_key_press(const Link< const KeyEvent &, bool > &rLink)
Definition: weld.hxx:248
void set_visible(bool bShow)
Definition: weld.hxx:2038
void connect_activate(const Link< const OString &, void > &rLink)
Definition: weld.hxx:2284
Link< Entry &, bool > m_aActivateHdl
Definition: weld.hxx:1621
Link< TreeView &, void > m_aModelChangedHdl
Definition: weld.hxx:879
void response(int nResponse)
Definition: weld.hxx:2499
void set_increments(int step, int page, FieldUnit eValueUnit)
Definition: weld.hxx:2011
bool signal_activate_link()
Definition: weld.hxx:1567
void set_primary_text(const OUString &rText)
Definition: weld.hxx:2540
int get_min(FieldUnit eValueUnit) const
Definition: weld.hxx:1997
void insert(int pos, const OUString &rStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface)
Definition: weld.hxx:947
Link< FormattedSpinButton &, void > m_aValueChangedHdl
Definition: weld.hxx:1763
ColumnToggleType
Definition: weld.hxx:829
OUString signal_query_tooltip(tools::Rectangle &rHelpArea)
Definition: weld.hxx:2207
void set_help_id(const OString &rName)
Definition: weld.hxx:2065
void select_all()
Definition: weld.hxx:1234
void connect_query_tooltip(const Link< tools::Rectangle &, OUString > &rLink)
Definition: weld.hxx:2232
void signal_changed()
Definition: weld.hxx:694
int convert_value_from(int nValue, FieldUnit eValueUnit) const
Definition: weld.hxx:1948
int get_checkbox_column_width() const
Definition: weld.hxx:1270
void append_separator(const OUString &rId)
Definition: weld.hxx:2386
Link< weld::Popover &, void > m_aCloseHdl
Definition: weld.hxx:2339
void signal_value_changed()
Definition: weld.hxx:1918
Link< const KeyEvent &, bool > m_aKeyReleaseHdl
Definition: weld.hxx:88
bool get_value_changed_from_saved() const
Definition: weld.hxx:1282
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:899
OString get_help_id() const
Definition: weld.hxx:2498
Link< const OString &, bool > m_aJumpPageHdl
Definition: weld.hxx:621
void connect_changed(const Link< TextView &, void > &rLink)
Definition: weld.hxx:2143
Link< DrawingArea &, bool > m_aDragBeginHdl
Definition: weld.hxx:2201
Size signal_custom_get_size(vcl::RenderContext &rDevice)
Definition: weld.hxx:706
Definition: menu.hxx:124
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:2064
Link< const CommandEvent &, bool > m_aCommandHdl
Definition: weld.hxx:1321
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:2311
void select_text(const OUString &rText)
Definition: weld.hxx:1043
TriState get_state() const
Definition: weld.hxx:1446
Link< const iter_string &, bool > m_aEditingDoneHdl
Definition: weld.hxx:873
bool iter_nth_child(TreeIter &rIter, int nChild) const
Definition: weld.hxx:1086
void signal_activated()
Definition: weld.hxx:1800
std::tuple< vcl::RenderContext &, const tools::Rectangle &, bool, const OUString & > render_args
Definition: weld.hxx:862
virtual bool get_entry_selection_bounds(int &rStartPos, int &rEndPos) override
Definition: weld.hxx:1894
void connect_input(const Link< int *, bool > &rLink)
Definition: weld.hxx:1747
unsigned char sal_uInt8
OutputDevice RenderContext
Definition: outdev.hxx:150
OUString const & get_saved_value() const
Definition: weld.hxx:1680
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:1886
void clicked()
Definition: weld.hxx:1412
virtual void set_entry_message_type(EntryMessageType eType) override
Definition: weld.hxx:1881
bool signal_editing_started(const TreeIter &rIter)
Definition: weld.hxx:904
virtual void connect_mouse_press(const Link< const MouseEvent &, bool > &rLink)
Definition: weld.hxx:260
bool signal_row_activated()
Definition: weld.hxx:889
bool get_value_changed_from_saved() const
Definition: weld.hxx:1681
virtual void set_entry_max_length(int nChars) override
Definition: weld.hxx:1887
void append(const OUString &rId, const OUString &rStr, const OUString &rImage)
Definition: weld.hxx:2319
void connect_menu_toggled(const Link< const OString &, void > &rLink)
Definition: weld.hxx:2408
void connect_command(const Link< const CommandEvent &, bool > &rLink)
Definition: weld.hxx:2227
std::function< int(const weld::TreeIter &, const weld::TreeIter &)> m_aCustomSort
Definition: weld.hxx:885
friend DialogController
Definition: weld.hxx:580
virtual ~SizeGroup()
Definition: weld.hxx:2417
void set_min(int min, FieldUnit eValueUnit)
Definition: weld.hxx:1983
void signal_value_changed()
Definition: weld.hxx:1583
void connect_value_changed(const Link< FormattedSpinButton &, void > &rLink)
Definition: weld.hxx:1773
bool get_state_changed_from_saved() const
Definition: weld.hxx:1475
void set_sensitive(bool sensitive)
Definition: weld.hxx:2032
TxtAlign
Definition: vclenum.hxx:362
void save_value()
Definition: weld.hxx:1679
virtual short run()
Definition: weld.hxx:2492
Link< render_args, void > m_aRenderHdl
Definition: weld.hxx:914
void signal_toggled(const iter_col &rIterCol)
Definition: weld.hxx:902
bool signal_item_activated()
Definition: weld.hxx:1324
Link< Scale &, void > m_aValueChangedHdl
Definition: weld.hxx:1581
Any value
PointerStyle
Definition: ptrstyle.hxx:25
bool iter_nth_sibling(TreeIter &rIter, int nChild) const
Definition: weld.hxx:1079
void connect_activate(const Link< Entry &, bool > &rLink)
Definition: weld.hxx:1667
void append_separator(const OUString &rId)
Definition: weld.hxx:2305
virtual void set_id(int pos, const OUString &rId) override
Definition: weld.hxx:1876
Link< const TreeIter &, bool > m_aExpandingHdl
Definition: weld.hxx:875
OUString get_title() const
Definition: weld.hxx:2496
void append(TreeIter *pRet=nullptr)
Definition: weld.hxx:945
void select_id(const OUString &rId)
Definition: weld.hxx:1059
void signal_toggled()
Definition: weld.hxx:1437
void connect_draw(const Link< draw_args, void > &rLink)
Definition: weld.hxx:2225
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:1804
void signal_selection_changed()
Definition: weld.hxx:1323
virtual void set_entry_text(const OUString &rStr) override
Definition: weld.hxx:1885
void connect_clicked(const Link< const OString &, void > &rLink)
Definition: weld.hxx:2407
int get_value(FieldUnit eDestUnit) const
Definition: weld.hxx:1958
Link< const OString &, void > m_aToggleMenuHdl
Definition: weld.hxx:2355
Link< const OString &, bool > m_aLeavePageHdl
Definition: weld.hxx:461
int get_max() const
Definition: weld.hxx:1733
void append_text(const OUString &rStr)
Definition: weld.hxx:718
FieldUnit m_eSrcUnit
Definition: weld.hxx:1910
Link< int *, bool > m_aInputHdl
Definition: weld.hxx:1691
TriState signal_input(int *result)
Definition: weld.hxx:1703
Link< const TreeIter &, OUString > m_aQueryTooltipHdl
Definition: weld.hxx:911
std::pair< vcl::RenderContext &, const OUString & > get_size_args
Definition: weld.hxx:860
unsigned int get_digits() const
Definition: weld.hxx:2042
Link< Expander &, void > m_aExpandedHdl
Definition: weld.hxx:2176
Link< Widget &, void > m_aFocusInHdl
Definition: weld.hxx:83
void append_item_radio(const OUString &rId, const OUString &rStr)
Definition: weld.hxx:1519
void set_max(int max)
Definition: weld.hxx:1721
OUString m_sSavedValue
Definition: weld.hxx:1615
FieldUnit get_unit() const
Definition: weld.hxx:1939
void connect_expanded(const Link< Expander &, void > &rLink)
Definition: weld.hxx:2186
Link< ComboBox &, void > m_aPopupToggledHdl
Definition: weld.hxx:688
virtual OUString get_active_id() const override
Definition: weld.hxx:1869
TriState
int get_height_rows(int nRows) const
Definition: weld.hxx:2128
void signal_value_changed()
Definition: weld.hxx:1693
void connect_output(const Link< SpinButton &, void > &rLink)
Definition: weld.hxx:1746
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:1222
std::unique_ptr< weld::Assistant > m_xAssistant
Definition: weld.hxx:2549
Link< const OString &, void > m_aActivateHdl
Definition: weld.hxx:2277
Link< Calendar &, void > m_aActivatedHdl
Definition: weld.hxx:1797
std::pair< const TreeIter &, OUString > iter_string
Definition: weld.hxx:858
std::unique_ptr< Entry > m_xEntry
Definition: weld.hxx:1821
std::unique_ptr< weld::MessageDialog > m_xDialog
Definition: weld.hxx:2520
void connect_focus_in(const Link< Widget &, void > &rLink)
Definition: weld.hxx:2056
const Dialog * getConstDialog() const
Definition: weld.hxx:2488
int denormalize(int nValue) const
Definition: weld.hxx:2031
void signal_column_clicked(int nColumn)
Definition: weld.hxx:890
Link< LinkButton &, bool > m_aActivateLinkHdl
Definition: weld.hxx:1565
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:968
virtual int find_text(const OUString &rStr) const override
Definition: weld.hxx:1863
void connect_value_changed(const Link< SpinButton &, void > &rLink)
Definition: weld.hxx:1744
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:2199
virtual bool has_entry() const override
Definition: weld.hxx:1880
void connect_closed(const Link< weld::Popover &, void > &rLink)
Definition: weld.hxx:2348
bool signal_editing_done(const iter_string &rIterText)
Definition: weld.hxx:906