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