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