Update git submodules
[LibreOffice.git] / vcl / inc / salvtables.hxx
blob62dc0e8ea8dbe5eae8b07a314e0889e32548a50f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 #pragma once
11 #include <vcl/builder.hxx>
12 #include <vcl/weld.hxx>
13 #include <vcl/svapp.hxx>
14 #include <vcl/syswin.hxx>
15 #include <vcl/settings.hxx>
16 #include <vcl/virdev.hxx>
17 #include <vcl/ctrl.hxx>
18 #include <vcl/toolkit/edit.hxx>
19 #include <vcl/formatter.hxx>
20 #include <vcl/toolkit/spinfld.hxx>
21 #include <vcl/toolkit/fixed.hxx>
22 #include <vcl/toolkit/fixedhyper.hxx>
23 #include <vcl/toolkit/lstbox.hxx>
24 #include <vcl/toolkit/menubtn.hxx>
25 #include <vcl/toolkit/prgsbar.hxx>
26 #include <vcl/toolkit/combobox.hxx>
27 #include <vcl/tabctrl.hxx>
28 #include <vcl/layout.hxx>
29 #include <vcl/toolkit/svtabbx.hxx>
30 #include <vcl/toolkit/svlbitm.hxx>
31 #include <o3tl/sorted_vector.hxx>
32 #include "calendar.hxx"
33 #include "iconview.hxx"
34 #include "messagedialog.hxx"
35 #include "verticaltabctrl.hxx"
37 namespace vcl
39 class RoadmapWizard;
42 class SalInstanceBuilder : public weld::Builder
44 protected:
45 std::unique_ptr<VclBuilder> m_xBuilder;
46 VclPtr<vcl::Window> m_aOwnedToplevel;
48 public:
49 SalInstanceBuilder(vcl::Window* pParent, std::u16string_view sUIRoot, const OUString& rUIFile,
50 const css::uno::Reference<css::frame::XFrame>& rFrame
51 = css::uno::Reference<css::frame::XFrame>());
53 virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OUString& id) override;
55 virtual std::unique_ptr<weld::Dialog> weld_dialog(const OUString& id) override;
57 virtual std::unique_ptr<weld::Assistant> weld_assistant(const OUString& id) override;
59 virtual std::unique_ptr<weld::Window> create_screenshot_window() override;
61 virtual std::unique_ptr<weld::Widget> weld_widget(const OUString& id) override;
63 virtual std::unique_ptr<weld::Container> weld_container(const OUString& id) override;
65 virtual std::unique_ptr<weld::Box> weld_box(const OUString& id) override;
67 virtual std::unique_ptr<weld::Paned> weld_paned(const OUString& id) override;
69 virtual std::unique_ptr<weld::Frame> weld_frame(const OUString& id) override;
71 virtual std::unique_ptr<weld::ScrolledWindow>
72 weld_scrolled_window(const OUString& id, bool bUserManagedScrolling = false) override;
74 virtual std::unique_ptr<weld::Notebook> weld_notebook(const OUString& id) override;
76 virtual std::unique_ptr<weld::Button> weld_button(const OUString& id) override;
78 virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OUString& id) override;
80 virtual std::unique_ptr<weld::MenuToggleButton>
81 weld_menu_toggle_button(const OUString& id) override;
83 virtual std::unique_ptr<weld::LinkButton> weld_link_button(const OUString& id) override;
85 virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const OUString& id) override;
87 virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OUString& id) override;
89 virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OUString& id) override;
91 virtual std::unique_ptr<weld::Scale> weld_scale(const OUString& id) override;
93 virtual std::unique_ptr<weld::ProgressBar> weld_progress_bar(const OUString& id) override;
95 virtual std::unique_ptr<weld::LevelBar> weld_level_bar(const OUString& id) override;
97 virtual std::unique_ptr<weld::Spinner> weld_spinner(const OUString& id) override;
99 virtual std::unique_ptr<weld::Image> weld_image(const OUString& id) override;
101 virtual std::unique_ptr<weld::Calendar> weld_calendar(const OUString& id) override;
103 virtual std::unique_ptr<weld::Entry> weld_entry(const OUString& id) override;
105 virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OUString& id) override;
107 virtual std::unique_ptr<weld::MetricSpinButton>
108 weld_metric_spin_button(const OUString& id, FieldUnit eUnit) override;
110 virtual std::unique_ptr<weld::FormattedSpinButton>
111 weld_formatted_spin_button(const OUString& id) override;
113 virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OUString& id) override;
115 virtual std::unique_ptr<weld::EntryTreeView>
116 weld_entry_tree_view(const OUString& containerid, const OUString& entryid,
117 const OUString& treeviewid) override;
119 virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OUString& id) override;
121 virtual std::unique_ptr<weld::IconView> weld_icon_view(const OUString& id) override;
123 virtual std::unique_ptr<weld::Label> weld_label(const OUString& id) override;
125 virtual std::unique_ptr<weld::TextView> weld_text_view(const OUString& id) override;
127 virtual std::unique_ptr<weld::Expander> weld_expander(const OUString& id) override;
129 virtual std::unique_ptr<weld::DrawingArea>
130 weld_drawing_area(const OUString& id, const a11yref& rA11yImpl = nullptr,
131 FactoryFunction pUITestFactoryFunction = nullptr,
132 void* pUserData = nullptr) override;
134 virtual std::unique_ptr<weld::Menu> weld_menu(const OUString& id) override;
136 virtual std::unique_ptr<weld::Popover> weld_popover(const OUString& id) override;
138 virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OUString& id) override;
140 virtual std::unique_ptr<weld::Scrollbar> weld_scrollbar(const OUString& id) override;
142 virtual std::unique_ptr<weld::SizeGroup> create_size_group() override;
144 OUString get_current_page_help_id() const;
146 virtual ~SalInstanceBuilder() override;
149 class SAL_DLLPUBLIC_RTTI SalInstanceMenu : public weld::Menu
151 protected:
152 VclPtr<PopupMenu> m_xMenu;
154 private:
155 bool m_bTakeOwnership;
156 sal_uInt16 m_nLastId;
158 DECL_DLLPRIVATE_LINK(SelectMenuHdl, ::Menu*, bool);
160 public:
161 SalInstanceMenu(PopupMenu* pMenu, bool bTakeOwnership);
162 virtual OUString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect,
163 weld::Placement ePlace = weld::Placement::Under) override;
164 virtual void set_sensitive(const OUString& rIdent, bool bSensitive) override;
165 virtual bool get_sensitive(const OUString& rIdent) const override;
166 virtual void set_active(const OUString& rIdent, bool bActive) override;
167 virtual bool get_active(const OUString& rIdent) const override;
168 virtual void set_label(const OUString& rIdent, const OUString& rLabel) override;
169 virtual OUString get_label(const OUString& rIdent) const override;
170 virtual void set_visible(const OUString& rIdent, bool bShow) override;
171 virtual void clear() override;
172 virtual void insert(int pos, const OUString& rId, const OUString& rStr,
173 const OUString* pIconName, VirtualDevice* pImageSurface,
174 const css::uno::Reference<css::graphic::XGraphic>& rImage,
175 TriState eCheckRadioFalse) override;
176 virtual void insert_separator(int pos, const OUString& rId) override;
177 virtual void set_item_help_id(const OUString& rIdent, const OUString& rHelpId) override;
178 virtual void remove(const OUString& rId) override;
179 virtual OUString get_id(int pos) const override;
180 virtual int n_children() const override;
181 PopupMenu* getMenu() const;
182 virtual ~SalInstanceMenu() override;
185 class SalFlashAttention;
187 class VCL_DLLPUBLIC SalInstanceWidget : public virtual weld::Widget
189 protected:
190 VclPtr<vcl::Window> m_xWidget;
191 std::unique_ptr<SalFlashAttention> m_xFlashAttention;
192 SalInstanceBuilder* m_pBuilder;
194 private:
195 DECL_LINK(EventListener, VclWindowEvent&, void);
196 DECL_LINK(KeyEventListener, VclWindowEvent&, bool);
197 DECL_LINK(MouseEventListener, VclWindowEvent&, void);
198 DECL_LINK(SettingsChangedHdl, VclWindowEvent&, void);
199 DECL_LINK(MnemonicActivateHdl, vcl::Window&, bool);
201 static void DoRecursivePaint(vcl::Window* pWindow, const Point& rPos, OutputDevice& rOutput);
203 const bool m_bTakeOwnership;
204 bool m_bEventListener;
205 bool m_bKeyEventListener;
206 bool m_bMouseEventListener;
207 int m_nBlockNotify;
208 int m_nFreezeCount;
210 protected:
211 void ensure_event_listener();
213 // we want the ability to mark key events as handled, so use this variant
214 // for those, we get all keystrokes in this case, so we will need to filter
215 // them later
216 void ensure_key_listener();
218 // we want the ability to know about mouse events that happen in our children
219 // so use this variant, we will need to filter them later
220 void ensure_mouse_listener();
222 bool IsFirstFreeze() const { return m_nFreezeCount == 0; }
223 bool IsLastThaw() const { return m_nFreezeCount == 1; }
225 virtual void HandleEventListener(VclWindowEvent& rEvent);
226 virtual bool HandleKeyEventListener(VclWindowEvent& rEvent);
227 virtual void HandleMouseEventListener(VclWindowEvent& rEvent);
229 public:
230 SalInstanceWidget(vcl::Window* pWidget, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
232 virtual void set_sensitive(bool sensitive) override;
234 virtual bool get_sensitive() const override;
236 virtual bool get_visible() const override;
238 virtual bool is_visible() const override;
240 virtual void set_can_focus(bool bCanFocus) override;
242 virtual void grab_focus() override;
244 virtual bool has_focus() const override;
246 virtual bool is_active() const override;
248 virtual bool has_child_focus() const override;
250 virtual void show() override;
252 virtual void hide() override;
254 virtual void set_size_request(int nWidth, int nHeight) override;
256 virtual Size get_size_request() const override;
258 virtual Size get_preferred_size() const override;
260 virtual float get_approximate_digit_width() const override;
262 virtual int get_text_height() const override;
264 virtual Size get_pixel_size(const OUString& rText) const override;
266 virtual vcl::Font get_font() override;
268 virtual OUString get_buildable_name() const override;
270 virtual void set_buildable_name(const OUString& rId) override;
272 virtual void set_help_id(const OUString& rId) override;
274 virtual OUString get_help_id() const override;
276 virtual void set_grid_left_attach(int nAttach) override;
278 virtual int get_grid_left_attach() const override;
280 virtual void set_grid_width(int nCols) override;
282 virtual void set_grid_top_attach(int nAttach) override;
284 virtual int get_grid_top_attach() const override;
286 virtual void set_hexpand(bool bExpand) override;
288 virtual bool get_hexpand() const override;
290 virtual void set_vexpand(bool bExpand) override;
292 virtual bool get_vexpand() const override;
294 virtual void set_margin_top(int nMargin) override;
296 virtual void set_margin_bottom(int nMargin) override;
298 virtual void set_margin_start(int nMargin) override;
300 virtual void set_margin_end(int nMargin) override;
302 virtual int get_margin_top() const override;
304 virtual int get_margin_bottom() const override;
306 virtual int get_margin_start() const override;
308 virtual int get_margin_end() const override;
310 virtual void set_accessible_name(const OUString& rName) override;
312 virtual void set_accessible_description(const OUString& rDescription) override;
314 virtual OUString get_accessible_name() const override;
316 virtual OUString get_accessible_description() const override;
318 virtual OUString get_accessible_id() const override;
320 virtual void set_accessible_relation_labeled_by(weld::Widget* pLabel) override;
322 virtual void set_tooltip_text(const OUString& rTip) override;
324 virtual OUString get_tooltip_text() const override;
326 virtual void set_cursor_data(void* pData) override;
328 virtual void connect_focus_in(const Link<Widget&, void>& rLink) override;
330 virtual void connect_mnemonic_activate(const Link<Widget&, bool>& rLink) override;
332 virtual void connect_focus_out(const Link<Widget&, void>& rLink) override;
334 virtual void connect_size_allocate(const Link<const Size&, void>& rLink) override;
336 virtual void connect_mouse_press(const Link<const MouseEvent&, bool>& rLink) override;
338 virtual void connect_mouse_move(const Link<const MouseEvent&, bool>& rLink) override;
340 virtual void connect_mouse_release(const Link<const MouseEvent&, bool>& rLink) override;
342 virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override;
344 virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink) override;
346 virtual void connect_style_updated(const Link<Widget&, void>& rLink) override;
348 virtual bool get_extents_relative_to(const Widget& rRelative, int& x, int& y, int& width,
349 int& height) const override;
351 virtual void grab_add() override;
353 virtual bool has_grab() const override;
355 virtual void grab_remove() override;
357 virtual bool get_direction() const override;
359 virtual void set_direction(bool bRTL) override;
361 virtual void freeze() override;
363 virtual void thaw() override;
365 virtual void set_busy_cursor(bool bBusy) override;
367 virtual std::unique_ptr<weld::Container> weld_parent() const override;
369 virtual ~SalInstanceWidget() override;
371 vcl::Window* getWidget() const;
373 void disable_notify_events();
375 bool notify_events_disabled() const;
377 void enable_notify_events();
379 virtual void queue_resize() override;
381 virtual void help_hierarchy_foreach(const std::function<bool(const OUString&)>& func) override;
383 virtual OUString strip_mnemonic(const OUString& rLabel) const override;
384 virtual OUString escape_ui_str(const OUString& rLabel) const override;
386 virtual VclPtr<VirtualDevice> create_virtual_device() const override;
388 virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() override;
389 virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard>
390 get_clipboard() const override;
392 virtual void connect_get_property_tree(const Link<tools::JsonWriter&, void>& rLink) override;
394 virtual void get_property_tree(tools::JsonWriter& rJsonWriter) override;
396 virtual void call_attention_to() override;
398 virtual void set_stack_background() override;
400 virtual void set_title_background() override;
402 virtual void set_toolbar_background() override;
404 virtual void set_highlight_background() override;
406 virtual void set_background(const Color& rColor) override;
408 virtual void draw(OutputDevice& rOutput, const Point& rPos, const Size& rSizePixel) override;
410 SystemWindow* getSystemWindow();
413 class SalInstanceLabel : public SalInstanceWidget, public virtual weld::Label
415 private:
416 // Control instead of FixedText so we can also use this for
417 // SelectableFixedText which is derived from Edit. We just typically need
418 // [G|S]etText which exists in their shared baseclass
419 VclPtr<Control> m_xLabel;
421 public:
422 SalInstanceLabel(Control* pLabel, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
424 virtual void set_label(const OUString& rText) override;
426 virtual OUString get_label() const override;
428 virtual void set_mnemonic_widget(Widget* pTarget) override;
430 virtual void set_label_type(weld::LabelType eType) override;
432 virtual void set_font(const vcl::Font& rFont) override;
434 virtual void set_font_color(const Color& rColor) override;
437 class SalInstanceContainer : public SalInstanceWidget, public virtual weld::Container
439 VclPtr<vcl::Window> m_xContainer;
441 public:
442 SalInstanceContainer(vcl::Window* pContainer, SalInstanceBuilder* pBuilder,
443 bool bTakeOwnership);
444 virtual void HandleEventListener(VclWindowEvent& rEvent) override;
445 virtual void connect_container_focus_changed(const Link<Container&, void>& rLink) override;
446 virtual void child_grab_focus() override;
447 virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) override;
448 virtual css::uno::Reference<css::awt::XWindow> CreateChildFrame() override;
451 class SalInstanceWindow : public SalInstanceContainer, public virtual weld::Window
453 private:
454 VclPtr<vcl::Window> m_xWindow;
456 DECL_LINK(HelpHdl, vcl::Window&, bool);
458 void override_child_help(vcl::Window* pParent);
460 void clear_child_help(vcl::Window* pParent);
462 void recursively_unset_default_buttons();
464 void implResetDefault(const vcl::Window* _pWindow);
466 public:
467 SalInstanceWindow(vcl::Window* pWindow, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
469 virtual void set_title(const OUString& rTitle) override;
471 virtual OUString get_title() const override;
473 void help();
475 virtual css::uno::Reference<css::awt::XWindow> GetXWindow() override;
477 virtual void resize_to_request() override;
479 virtual void window_move(int x, int y) override;
481 virtual Size get_size() const override;
483 virtual Point get_position() const override;
485 virtual AbsoluteScreenPixelRectangle get_monitor_workarea() const override;
487 virtual bool get_resizable() const override;
489 virtual bool has_toplevel_focus() const override;
491 virtual void present() override;
493 virtual void change_default_widget(weld::Widget* pOld, weld::Widget* pNew) override;
495 virtual bool is_default_widget(const weld::Widget* pCandidate) const override;
497 virtual void set_window_state(const OUString& rStr) override;
499 virtual OUString get_window_state(vcl::WindowDataMask nMask) const override;
501 virtual SystemEnvData get_system_data() const override;
503 virtual weld::ScreenShotCollection collect_screenshot_data() override;
505 virtual VclPtr<VirtualDevice> screenshot() override;
507 virtual const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() override;
509 virtual ~SalInstanceWindow() override;
512 class SalInstanceDialog : public SalInstanceWindow, public virtual weld::Dialog
514 protected:
515 VclPtr<::Dialog> m_xDialog;
517 private:
518 // for calc ref dialog that shrink to range selection widgets and resize back
519 VclPtr<vcl::Window> m_xRefEdit;
520 std::vector<VclPtr<vcl::Window>> m_aHiddenWidgets; // vector of hidden Controls
521 tools::Long m_nOldEditWidthReq; // Original width request of the input field
522 sal_Int32 m_nOldBorderWidth; // border width for expanded dialog
524 DECL_LINK(PopupScreenShotMenuHdl, const CommandEvent&, bool);
526 public:
527 SalInstanceDialog(::Dialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
529 virtual bool runAsync(std::shared_ptr<weld::DialogController> const& rxOwner,
530 const std::function<void(sal_Int32)>& rEndDialogFn) override;
532 virtual bool runAsync(std::shared_ptr<Dialog> const& rxSelf,
533 const std::function<void(sal_Int32)>& rEndDialogFn) override;
535 virtual void collapse(weld::Widget* pEdit, weld::Widget* pButton) override;
537 virtual void undo_collapse() override;
539 virtual void
540 SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink) override;
542 virtual int run() override;
544 virtual void response(int nResponse) override;
546 virtual void add_button(const OUString& rText, int nResponse,
547 const OUString& rHelpId = {}) override;
549 virtual void set_modal(bool bModal) override;
551 virtual bool get_modal() const override;
553 virtual void set_centered_on_parent(bool /*bTrackGeometryRequests*/) override;
555 virtual std::unique_ptr<weld::Button> weld_button_for_response(int nResponse) override;
557 virtual void set_default_response(int nResponse) override;
559 virtual std::unique_ptr<weld::Container> weld_content_area() override;
562 class SalInstanceAssistant : public SalInstanceDialog, public virtual weld::Assistant
564 protected:
565 VclPtr<vcl::RoadmapWizard> m_xWizard;
567 private:
568 std::vector<std::unique_ptr<SalInstanceContainer>> m_aPages;
569 std::vector<VclPtr<TabPage>> m_aAddedPages;
570 std::vector<int> m_aIds;
571 std::vector<VclPtr<VclGrid>> m_aAddedGrids;
572 Idle m_aUpdateRoadmapIdle;
574 int find_page(std::u16string_view rIdent) const;
575 int find_id(int nId) const;
577 DECL_LINK(OnRoadmapItemSelected, LinkParamNone*, void);
578 DECL_LINK(UpdateRoadmap_Hdl, Timer*, void);
580 public:
581 SalInstanceAssistant(vcl::RoadmapWizard* pDialog, SalInstanceBuilder* pBuilder,
582 bool bTakeOwnership);
583 virtual int get_current_page() const override;
584 virtual int get_n_pages() const override;
585 virtual OUString get_page_ident(int nPage) const override;
586 virtual OUString get_current_page_ident() const override;
587 virtual void set_current_page(int nPage) override;
588 virtual void set_current_page(const OUString& rIdent) override;
589 virtual void set_page_index(const OUString& rIdent, int nNewIndex) override;
590 virtual weld::Container* append_page(const OUString& rIdent) override;
591 virtual OUString get_page_title(const OUString& rIdent) const override;
592 virtual void set_page_title(const OUString& rIdent, const OUString& rTitle) override;
593 virtual void set_page_sensitive(const OUString& rIdent, bool bSensitive) override;
594 virtual void set_page_side_help_id(const OUString& rHelpId) override;
595 virtual void set_page_side_image(const OUString& rImage) override;
596 std::unique_ptr<weld::Button> weld_button_for_response(int nResponse) override;
598 virtual ~SalInstanceAssistant() override;
601 class WeldTextFilter final : public TextFilter
603 private:
604 Link<OUString&, bool>& m_rInsertTextHdl;
606 public:
607 WeldTextFilter(Link<OUString&, bool>& rInsertTextHdl);
609 virtual OUString filter(const OUString& rText) override;
612 class SalInstanceEntry : public SalInstanceWidget, public virtual weld::Entry
614 private:
615 VclPtr<::Edit> m_xEntry;
617 DECL_LINK(ChangeHdl, Edit&, void);
618 DECL_LINK(CursorListener, VclWindowEvent&, void);
619 DECL_LINK(ActivateHdl, Edit&, bool);
621 WeldTextFilter m_aTextFilter;
623 public:
624 SalInstanceEntry(::Edit* pEntry, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
626 virtual void set_text(const OUString& rText) override;
628 virtual OUString get_text() const override;
630 virtual void set_width_chars(int nChars) override;
632 virtual int get_width_chars() const override;
634 virtual void set_max_length(int nChars) override;
636 virtual void select_region(int nStartPos, int nEndPos) override;
638 bool get_selection_bounds(int& rStartPos, int& rEndPos) override;
640 virtual void replace_selection(const OUString& rText) override;
642 virtual void set_position(int nCursorPos) override;
644 virtual int get_position() const override;
646 virtual void set_editable(bool bEditable) override;
648 virtual bool get_editable() const override;
650 virtual void set_overwrite_mode(bool bOn) override;
652 virtual bool get_overwrite_mode() const override;
654 virtual void set_message_type(weld::EntryMessageType eType) override;
656 virtual void set_font(const vcl::Font& rFont) override;
658 virtual void set_font_color(const Color& rColor) override;
660 virtual void connect_cursor_position(const Link<Entry&, void>& rLink) override;
662 virtual void set_placeholder_text(const OUString& rText) override;
664 Edit& getEntry();
666 void fire_signal_changed();
668 virtual void cut_clipboard() override;
670 virtual void copy_clipboard() override;
672 virtual void paste_clipboard() override;
674 virtual void set_alignment(TxtAlign eXAlign) override;
676 virtual ~SalInstanceEntry() override;
679 class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton
681 VclPtr<FormattedField> m_xButton;
683 protected:
684 Formatter& m_rFormatter;
686 private:
687 DECL_LINK(UpDownHdl, SpinField&, void);
688 DECL_LINK(LoseFocusHdl, Control&, void);
689 DECL_LINK(OutputHdl, LinkParamNone*, bool);
690 DECL_LINK(InputHdl, sal_Int64*, TriState);
691 DECL_LINK(ActivateHdl, Edit&, bool);
693 double toField(sal_Int64 nValue) const;
695 sal_Int64 fromField(double fValue) const;
697 public:
698 SalInstanceSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder,
699 bool bTakeOwnership);
701 virtual sal_Int64 get_value() const override;
703 virtual void set_value(sal_Int64 value) override;
705 virtual void set_range(sal_Int64 min, sal_Int64 max) override;
707 virtual void get_range(sal_Int64& min, sal_Int64& max) const override;
709 virtual void set_increments(sal_Int64 step, sal_Int64 /*page*/) override;
711 virtual void get_increments(sal_Int64& step, sal_Int64& page) const override;
713 virtual void set_digits(unsigned int digits) override;
715 // SpinButton may be comprised of multiple subwidgets, consider the lot as
716 // one thing for focus
717 virtual bool has_focus() const override;
719 //off by default for direct SpinButtons, MetricSpinButton enables it
720 void SetUseThousandSep();
722 virtual unsigned int get_digits() const override;
724 virtual ~SalInstanceSpinButton() override;
727 //ComboBox and ListBox have similar apis, ComboBoxes in LibreOffice have an edit box and ListBoxes
728 //don't. This distinction isn't there in Gtk. Use a template to sort this problem out.
729 template <class vcl_type>
730 class SalInstanceComboBox : public SalInstanceWidget, public virtual weld::ComboBox
732 protected:
733 // owner for ListBox/ComboBox UserData
734 std::vector<std::shared_ptr<OUString>> m_aUserData;
735 VclPtr<vcl_type> m_xComboBox;
736 ScopedVclPtr<MenuButton> m_xMenuButton;
737 OUString m_sMenuButtonRow;
739 public:
740 SalInstanceComboBox(vcl_type* pComboBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
741 : SalInstanceWidget(pComboBox, pBuilder, bTakeOwnership)
742 , m_xComboBox(pComboBox)
746 virtual int get_active() const override
748 const sal_Int32 nRet = m_xComboBox->GetSelectedEntryPos();
749 if (nRet == LISTBOX_ENTRY_NOTFOUND)
750 return -1;
751 return nRet;
754 const OUString* getEntryData(int index) const
756 return static_cast<const OUString*>(m_xComboBox->GetEntryData(index));
759 // ComboBoxes are comprised of multiple subwidgets, consider the lot as
760 // one thing for focus
761 virtual bool has_focus() const override
763 return m_xWidget->HasChildPathFocus()
764 || (m_xMenuButton && (m_xMenuButton->HasFocus() || m_xMenuButton->InPopupMode()));
767 virtual OUString get_active_id() const override
769 sal_Int32 nPos = m_xComboBox->GetSelectedEntryPos();
770 const OUString* pRet;
771 if (nPos != LISTBOX_ENTRY_NOTFOUND)
772 pRet = getEntryData(m_xComboBox->GetSelectedEntryPos());
773 else
774 pRet = nullptr;
775 if (!pRet)
776 return OUString();
777 return *pRet;
780 virtual void set_active_id(const OUString& rStr) override
782 for (int i = 0; i < get_count(); ++i)
784 const OUString* pId = getEntryData(i);
785 if (!pId)
786 continue;
787 if (*pId == rStr)
788 m_xComboBox->SelectEntryPos(i);
792 virtual void set_active(int pos) override
794 assert(m_xComboBox->IsUpdateMode()
795 && "don't set_active when frozen, set_active after thaw. Note selection doesn't "
796 "survive a "
797 "freeze");
798 if (pos == -1)
800 m_xComboBox->SetNoSelection();
801 return;
803 m_xComboBox->SelectEntryPos(pos);
806 virtual OUString get_text(int pos) const override { return m_xComboBox->GetEntry(pos); }
808 virtual OUString get_id(int pos) const override
810 const OUString* pRet = getEntryData(pos);
811 if (!pRet)
812 return OUString();
813 return *pRet;
816 virtual void set_id(int row, const OUString& rId) override
818 m_aUserData.emplace_back(std::make_unique<OUString>(rId));
819 m_xComboBox->SetEntryData(row, m_aUserData.back().get());
822 virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems,
823 bool bKeepExisting) override
825 freeze();
826 if (!bKeepExisting)
827 clear();
828 for (const auto& rItem : rItems)
830 insert(-1, rItem.sString, rItem.sId.isEmpty() ? nullptr : &rItem.sId,
831 rItem.sImage.isEmpty() ? nullptr : &rItem.sImage, nullptr);
833 thaw();
836 virtual int get_count() const override { return m_xComboBox->GetEntryCount(); }
838 virtual int find_text(const OUString& rStr) const override
840 const sal_Int32 nRet = m_xComboBox->GetEntryPos(rStr);
841 if (nRet == LISTBOX_ENTRY_NOTFOUND)
842 return -1;
843 return nRet;
846 virtual int find_id(const OUString& rStr) const override
848 for (int i = 0; i < get_count(); ++i)
850 const OUString* pId = getEntryData(i);
851 if (!pId)
852 continue;
853 if (*pId == rStr)
854 return i;
856 return -1;
859 virtual void clear() override
861 m_xComboBox->Clear();
862 m_aUserData.clear();
865 virtual void make_sorted() override
867 m_xComboBox->SetStyle(m_xComboBox->GetStyle() | WB_SORT);
870 virtual bool get_popup_shown() const override { return m_xComboBox->IsInDropDown(); }
872 virtual void connect_popup_toggled(const Link<ComboBox&, void>& rLink) override
874 weld::ComboBox::connect_popup_toggled(rLink);
875 ensure_event_listener();
878 void call_signal_custom_render(UserDrawEvent* pEvent)
880 vcl::RenderContext* pRenderContext = pEvent->GetRenderContext();
881 auto nPos = pEvent->GetItemId();
882 const tools::Rectangle& rRect = pEvent->GetRect();
883 const OUString sId = get_id(nPos);
884 signal_custom_render(*pRenderContext, rRect, pEvent->IsSelected(), sId);
885 m_xComboBox->DrawEntry(*pEvent); // draw separator
887 if (m_xMenuButton && m_xMenuButton->IsVisible() && m_sMenuButtonRow == sId)
889 vcl::Window* pEventWindow = m_xComboBox->GetMainWindow();
890 if (m_xMenuButton->GetParent() != pEventWindow)
891 m_xMenuButton->SetParent(pEventWindow);
892 int nButtonWidth = get_menu_button_width();
893 m_xMenuButton->SetSizePixel(Size(nButtonWidth, rRect.GetHeight()));
894 m_xMenuButton->SetPosPixel(Point(rRect.GetWidth() - nButtonWidth, rRect.Top()));
898 VclPtr<VirtualDevice> create_render_virtual_device() const override
900 auto xRet = VclPtr<VirtualDevice>::Create();
901 xRet->SetBackground(Application::GetSettings().GetStyleSettings().GetFieldColor());
902 return xRet;
905 virtual void set_item_menu(const OUString& rIdent, weld::Menu* pMenu) override
907 SalInstanceMenu* pInstanceMenu = dynamic_cast<SalInstanceMenu*>(pMenu);
909 PopupMenu* pPopup = pInstanceMenu ? pInstanceMenu->getMenu() : nullptr;
911 if (!m_xMenuButton)
912 m_xMenuButton
913 = VclPtr<MenuButton>::Create(m_xComboBox, WB_FLATBUTTON | WB_NOPOINTERFOCUS);
915 m_xMenuButton->SetPopupMenu(pPopup, false);
916 m_xMenuButton->Show(pPopup != nullptr);
917 m_sMenuButtonRow = rIdent;
920 int get_menu_button_width() const override
922 OutputDevice* pDefault = Application::GetDefaultDevice();
923 return 20 * (pDefault ? pDefault->GetDPIScaleFactor() : 1.0);
926 void set_max_drop_down_rows(int nRows) override { m_xComboBox->SetDropDownLineCount(nRows); }
928 void CallHandleEventListener(VclWindowEvent& rEvent)
930 if (rEvent.GetId() == VclEventId::DropdownPreOpen
931 || rEvent.GetId() == VclEventId::DropdownClose)
933 signal_popup_toggled();
934 return;
936 SalInstanceWidget::HandleEventListener(rEvent);
940 class SalInstanceComboBoxWithoutEdit : public SalInstanceComboBox<ListBox>
942 private:
943 DECL_LINK(SelectHdl, ListBox&, void);
945 public:
946 SalInstanceComboBoxWithoutEdit(ListBox* pListBox, SalInstanceBuilder* pBuilder,
947 bool bTakeOwnership);
949 virtual OUString get_active_text() const override;
951 virtual void remove(int pos) override;
953 virtual void insert(int pos, const OUString& rStr, const OUString* pId,
954 const OUString* pIconName, VirtualDevice* pImageSurface) override;
956 virtual void insert_separator(int pos, const OUString& /*rId*/) override;
958 virtual bool has_entry() const override;
960 virtual bool changed_by_direct_pick() const override;
962 virtual void set_entry_message_type(weld::EntryMessageType /*eType*/) override;
964 virtual void set_entry_text(const OUString& /*rText*/) override;
966 virtual void select_entry_region(int /*nStartPos*/, int /*nEndPos*/) override;
968 virtual bool get_entry_selection_bounds(int& /*rStartPos*/, int& /*rEndPos*/) override;
970 virtual void set_entry_width_chars(int /*nChars*/) override;
972 virtual void set_entry_max_length(int /*nChars*/) override;
974 virtual void set_entry_completion(bool, bool bCaseSensitive = false) override;
976 virtual void set_entry_placeholder_text(const OUString&) override;
978 virtual void set_entry_editable(bool bEditable) override;
980 virtual void cut_entry_clipboard() override;
982 virtual void copy_entry_clipboard() override;
984 virtual void paste_entry_clipboard() override;
986 virtual void set_font(const vcl::Font& rFont) override;
988 virtual void set_entry_font(const vcl::Font&) override;
990 virtual vcl::Font get_entry_font() override;
992 virtual void set_custom_renderer(bool bOn) override;
994 virtual int get_max_mru_count() const override;
996 virtual void set_max_mru_count(int) override;
998 virtual OUString get_mru_entries() const override;
1000 virtual void set_mru_entries(const OUString&) override;
1002 virtual void HandleEventListener(VclWindowEvent& rEvent) override;
1004 virtual ~SalInstanceComboBoxWithoutEdit() override;
1007 class SalInstanceComboBoxWithEdit : public SalInstanceComboBox<ComboBox>
1009 private:
1010 DECL_LINK(ChangeHdl, Edit&, void);
1011 DECL_LINK(EntryActivateHdl, Edit&, bool);
1012 DECL_LINK(SelectHdl, ::ComboBox&, void);
1013 DECL_LINK(UserDrawHdl, UserDrawEvent*, void);
1014 WeldTextFilter m_aTextFilter;
1015 bool m_bInSelect;
1017 public:
1018 SalInstanceComboBoxWithEdit(::ComboBox* pComboBox, SalInstanceBuilder* pBuilder,
1019 bool bTakeOwnership);
1021 virtual bool has_entry() const override;
1023 virtual bool changed_by_direct_pick() const override;
1025 virtual void set_entry_message_type(weld::EntryMessageType eType) override;
1027 virtual OUString get_active_text() const override;
1029 virtual void remove(int pos) override;
1031 virtual void insert(int pos, const OUString& rStr, const OUString* pId,
1032 const OUString* pIconName, VirtualDevice* pImageSurface) override;
1034 virtual void insert_separator(int pos, const OUString& /*rId*/) override;
1036 virtual void set_entry_text(const OUString& rText) override;
1038 virtual void set_entry_width_chars(int nChars) override;
1040 virtual void set_entry_max_length(int nChars) override;
1042 virtual void set_entry_completion(bool bEnable, bool bCaseSensitive = false) override;
1044 virtual void set_entry_placeholder_text(const OUString& rText) override;
1046 virtual void set_entry_editable(bool bEditable) override;
1048 virtual void cut_entry_clipboard() override;
1050 virtual void copy_entry_clipboard() override;
1052 virtual void paste_entry_clipboard() override;
1054 virtual void select_entry_region(int nStartPos, int nEndPos) override;
1056 virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) override;
1058 virtual void set_font(const vcl::Font& rFont) override;
1060 virtual void set_entry_font(const vcl::Font& rFont) override;
1062 virtual vcl::Font get_entry_font() override;
1064 virtual void set_custom_renderer(bool bOn) override;
1066 virtual int get_max_mru_count() const override;
1068 virtual void set_max_mru_count(int nCount) override;
1070 virtual OUString get_mru_entries() const override;
1072 virtual void set_mru_entries(const OUString& rEntries) override;
1074 virtual void HandleEventListener(VclWindowEvent& rEvent) override;
1076 virtual void call_attention_to() override;
1078 virtual ~SalInstanceComboBoxWithEdit() override;
1081 class SalInstanceButton : public SalInstanceWidget, public virtual weld::Button
1083 private:
1084 VclPtr<::Button> m_xButton;
1085 Link<::Button*, void> const m_aOldClickHdl;
1087 DECL_LINK(ClickHdl, ::Button*, void);
1089 public:
1090 SalInstanceButton(::Button* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1092 virtual void set_label(const OUString& rText) override;
1094 virtual void set_image(VirtualDevice* pDevice) override;
1096 virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override;
1098 virtual void set_from_icon_name(const OUString& rIconName) override;
1100 virtual OUString get_label() const override;
1102 virtual void set_font(const vcl::Font& rFont) override;
1104 virtual void set_custom_button(VirtualDevice* pDevice) override;
1106 virtual ~SalInstanceButton() override;
1109 class SalInstanceToggleButton : public SalInstanceButton, public virtual weld::ToggleButton
1111 private:
1112 VclPtr<PushButton> m_xToggleButton;
1114 DECL_LINK(ToggleListener, VclWindowEvent&, void);
1116 public:
1117 SalInstanceToggleButton(PushButton* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
1118 : SalInstanceButton(pButton, pBuilder, bTakeOwnership)
1119 , m_xToggleButton(pButton)
1121 m_xToggleButton->setToggleButton(true);
1124 virtual void connect_toggled(const Link<Toggleable&, void>& rLink) override
1126 assert(!m_aToggleHdl.IsSet());
1127 m_xToggleButton->AddEventListener(LINK(this, SalInstanceToggleButton, ToggleListener));
1128 weld::ToggleButton::connect_toggled(rLink);
1131 virtual void set_active(bool active) override
1133 disable_notify_events();
1134 m_xToggleButton->Check(active);
1135 enable_notify_events();
1138 virtual bool get_active() const override { return m_xToggleButton->IsChecked(); }
1140 virtual void set_inconsistent(bool inconsistent) override
1142 disable_notify_events();
1143 m_xToggleButton->SetState(inconsistent ? TRISTATE_INDET : TRISTATE_FALSE);
1144 enable_notify_events();
1147 virtual bool get_inconsistent() const override
1149 return m_xToggleButton->GetState() == TRISTATE_INDET;
1152 virtual ~SalInstanceToggleButton() override
1154 if (m_aToggleHdl.IsSet())
1155 m_xToggleButton->RemoveEventListener(
1156 LINK(this, SalInstanceToggleButton, ToggleListener));
1160 class SalInstanceNotebook : public SalInstanceWidget, public virtual weld::Notebook
1162 private:
1163 VclPtr<TabControl> m_xNotebook;
1164 /// Constructed on-demand.
1165 mutable std::map<OUString, std::shared_ptr<SalInstanceContainer>> m_aPages;
1166 std::map<OUString, std::pair<VclPtr<TabPage>, VclPtr<VclGrid>>> m_aAddedPages;
1168 DECL_LINK(DeactivatePageHdl, TabControl*, bool);
1169 DECL_LINK(ActivatePageHdl, TabControl*, void);
1171 public:
1172 SalInstanceNotebook(TabControl* pNotebook, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1174 virtual int get_current_page() const override;
1176 virtual int get_page_index(const OUString& rIdent) const override;
1178 virtual OUString get_page_ident(int nPage) const override;
1180 virtual OUString get_current_page_ident() const override;
1182 virtual weld::Container* get_page(const OUString& rIdent) const override;
1184 virtual void set_current_page(int nPage) override;
1186 virtual void set_current_page(const OUString& rIdent) override;
1188 virtual void remove_page(const OUString& rIdent) override;
1190 virtual void insert_page(const OUString& rIdent, const OUString& rLabel, int nPos) override;
1192 virtual int get_n_pages() const override;
1194 virtual OUString get_tab_label_text(const OUString& rIdent) const override;
1196 virtual void set_tab_label_text(const OUString& rIdent, const OUString& rText) override;
1198 virtual void set_show_tabs(bool bShow) override;
1200 virtual ~SalInstanceNotebook() override;
1203 class SalInstanceMessageDialog : public SalInstanceDialog, public virtual weld::MessageDialog
1205 protected:
1206 VclPtr<::MessageDialog> m_xMessageDialog;
1208 public:
1209 SalInstanceMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder,
1210 bool bTakeOwnership);
1212 virtual void set_primary_text(const OUString& rText) override;
1214 virtual OUString get_primary_text() const override;
1216 virtual void set_secondary_text(const OUString& rText) override;
1218 virtual OUString get_secondary_text() const override;
1220 virtual std::unique_ptr<weld::Container> weld_message_area() override;
1223 class SalInstanceLinkButton : public SalInstanceWidget, public virtual weld::LinkButton
1225 private:
1226 VclPtr<FixedHyperlink> m_xButton;
1227 Link<FixedHyperlink&, void> m_aOrigClickHdl;
1229 DECL_LINK(ClickHdl, FixedHyperlink&, void);
1231 public:
1232 SalInstanceLinkButton(FixedHyperlink* pButton, SalInstanceBuilder* pBuilder,
1233 bool bTakeOwnership)
1234 : SalInstanceWidget(pButton, pBuilder, bTakeOwnership)
1235 , m_xButton(pButton)
1237 m_aOrigClickHdl = m_xButton->GetClickHdl();
1238 m_xButton->SetClickHdl(LINK(this, SalInstanceLinkButton, ClickHdl));
1241 virtual void set_label(const OUString& rText) override { m_xButton->SetText(rText); }
1243 virtual OUString get_label() const override { return m_xButton->GetText(); }
1245 virtual void set_uri(const OUString& rUri) override { m_xButton->SetURL(rUri); }
1247 virtual OUString get_uri() const override { return m_xButton->GetURL(); }
1249 virtual void set_label_wrap(bool wrap) override;
1251 virtual ~SalInstanceLinkButton() override { m_xButton->SetClickHdl(m_aOrigClickHdl); }
1254 class SalInstanceCheckButton : public SalInstanceButton, public virtual weld::CheckButton
1256 private:
1257 VclPtr<CheckBox> m_xCheckButton;
1259 DECL_LINK(ToggleHdl, CheckBox&, void);
1261 public:
1262 SalInstanceCheckButton(CheckBox* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1264 virtual void set_active(bool active) override;
1266 virtual bool get_active() const override;
1268 virtual void set_inconsistent(bool inconsistent) override;
1270 virtual bool get_inconsistent() const override;
1272 virtual void set_label(const OUString& rText) override { SalInstanceButton::set_label(rText); }
1274 virtual OUString get_label() const override { return SalInstanceButton::get_label(); }
1276 virtual void set_label_wrap(bool wrap) override;
1278 virtual ~SalInstanceCheckButton() override;
1281 class SalInstanceDrawingArea : public SalInstanceWidget, public virtual weld::DrawingArea
1283 private:
1284 VclPtr<VclDrawingArea> m_xDrawingArea;
1286 typedef std::pair<vcl::RenderContext&, const tools::Rectangle&> target_and_area;
1287 DECL_LINK(PaintHdl, target_and_area, void);
1288 DECL_LINK(ResizeHdl, const Size&, void);
1289 DECL_LINK(MousePressHdl, const MouseEvent&, bool);
1290 DECL_LINK(MouseMoveHdl, const MouseEvent&, bool);
1291 DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool);
1292 DECL_LINK(KeyPressHdl, const KeyEvent&, bool);
1293 DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool);
1294 DECL_LINK(StyleUpdatedHdl, VclDrawingArea&, void);
1295 DECL_LINK(CommandHdl, const CommandEvent&, bool);
1296 DECL_LINK(QueryTooltipHdl, tools::Rectangle&, OUString);
1297 DECL_LINK(GetSurroundingHdl, OUString&, int);
1298 DECL_LINK(DeleteSurroundingHdl, const Selection&, bool);
1299 DECL_LINK(StartDragHdl, VclDrawingArea*, bool);
1301 // SalInstanceWidget has a generic listener for all these
1302 // events, ignore the ones we have specializations for
1303 // in VclDrawingArea
1304 virtual void HandleEventListener(VclWindowEvent& rEvent) override;
1306 virtual void HandleMouseEventListener(VclWindowEvent& rEvent) override;
1308 virtual bool HandleKeyEventListener(VclWindowEvent& /*rEvent*/) override;
1310 public:
1311 SalInstanceDrawingArea(VclDrawingArea* pDrawingArea, SalInstanceBuilder* pBuilder,
1312 const a11yref& rAlly, FactoryFunction pUITestFactoryFunction,
1313 void* pUserData, bool bTakeOwnership);
1315 virtual void queue_draw() override;
1317 virtual void queue_draw_area(int x, int y, int width, int height) override;
1319 virtual void connect_size_allocate(const Link<const Size&, void>& rLink) override;
1321 virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override;
1323 virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink) override;
1325 virtual void connect_style_updated(const Link<Widget&, void>& rLink) override;
1327 virtual void set_cursor(PointerStyle ePointerStyle) override;
1329 virtual Point get_pointer_position() const override;
1331 virtual void set_input_context(const InputContext& rInputContext) override;
1333 virtual void im_context_set_cursor_location(const tools::Rectangle& rCursorRect,
1334 int nExtTextInputWidth) override;
1336 virtual a11yref get_accessible_parent() override;
1338 virtual a11yrelationset get_accessible_relation_set() override;
1340 virtual AbsoluteScreenPixelPoint get_accessible_location_on_screen() override;
1342 virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rHelper,
1343 sal_uInt8 eDNDConstants) override;
1345 virtual ~SalInstanceDrawingArea() override;
1347 virtual OutputDevice& get_ref_device() override;
1349 virtual void click(const Point& rPos) override;
1351 virtual void dblclick(const Point& rPos) override;
1353 virtual void mouse_up(const Point& rPos) override;
1355 virtual void mouse_down(const Point& rPos) override;
1357 virtual void mouse_move(const Point& rPos) override;
1360 class SalInstanceToolbar : public SalInstanceWidget, public virtual weld::Toolbar
1362 protected:
1363 VclPtr<ToolBox> m_xToolBox;
1364 std::map<ToolBoxItemId, VclPtr<vcl::Window>> m_aFloats;
1365 std::map<ToolBoxItemId, VclPtr<PopupMenu>> m_aMenus;
1367 OUString m_sStartShowIdent;
1369 DECL_LINK(ClickHdl, ToolBox*, void);
1370 DECL_LINK(DropdownClick, ToolBox*, void);
1371 DECL_LINK(MenuToggleListener, VclWindowEvent&, void);
1373 public:
1374 SalInstanceToolbar(ToolBox* pToolBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1376 virtual void set_item_sensitive(const OUString& rIdent, bool bSensitive) override;
1378 virtual bool get_item_sensitive(const OUString& rIdent) const override;
1380 virtual void set_item_visible(const OUString& rIdent, bool bVisible) override;
1382 virtual void set_item_help_id(const OUString& rIdent, const OUString& rHelpId) override;
1384 virtual bool get_item_visible(const OUString& rIdent) const override;
1386 virtual void set_item_active(const OUString& rIdent, bool bActive) override;
1388 virtual bool get_item_active(const OUString& rIdent) const override;
1390 void set_menu_item_active(const OUString& rIdent, bool bActive) override;
1392 bool get_menu_item_active(const OUString& rIdent) const override;
1394 virtual void set_item_popover(const OUString& rIdent, weld::Widget* pPopover) override;
1396 virtual void set_item_menu(const OUString& rIdent, weld::Menu* pMenu) override;
1398 virtual void insert_item(int pos, const OUString& rId) override;
1400 virtual void insert_separator(int pos, const OUString& /*rId*/) override;
1402 virtual int get_n_items() const override;
1404 virtual OUString get_item_ident(int nIndex) const override;
1406 virtual void set_item_ident(int nIndex, const OUString& rIdent) override;
1408 virtual void set_item_label(int nIndex, const OUString& rLabel) override;
1410 virtual OUString get_item_label(const OUString& rIdent) const override;
1412 virtual void set_item_label(const OUString& rIdent, const OUString& rLabel) override;
1414 virtual void set_item_icon_name(const OUString& rIdent, const OUString& rIconName) override;
1416 virtual void set_item_image_mirrored(const OUString& rIdent, bool bMirrored) override;
1418 virtual void set_item_image(const OUString& rIdent,
1419 const css::uno::Reference<css::graphic::XGraphic>& rIcon) override;
1421 virtual void set_item_image(const OUString& rIdent, VirtualDevice* pDevice) override;
1423 virtual void set_item_image(int nIndex,
1424 const css::uno::Reference<css::graphic::XGraphic>& rIcon) override;
1426 virtual void set_item_tooltip_text(int nIndex, const OUString& rTip) override;
1428 virtual void set_item_tooltip_text(const OUString& rIdent, const OUString& rTip) override;
1430 virtual void set_item_accessible_name(int nIndex, const OUString& rName) override;
1432 virtual void set_item_accessible_name(const OUString& rIdent, const OUString& rName) override;
1434 virtual OUString get_item_tooltip_text(const OUString& rIdent) const override;
1436 virtual vcl::ImageType get_icon_size() const override;
1438 virtual void set_icon_size(vcl::ImageType eType) override;
1440 virtual sal_uInt16 get_modifier_state() const override;
1442 virtual int get_drop_index(const Point& rPoint) const override;
1444 virtual ~SalInstanceToolbar() override;
1447 class SalInstanceTextView : public SalInstanceWidget, public virtual weld::TextView
1449 private:
1450 VclPtr<VclMultiLineEdit> m_xTextView;
1451 Link<ScrollBar*, void> m_aOrigVScrollHdl;
1453 DECL_LINK(ChangeHdl, Edit&, void);
1454 DECL_LINK(VscrollHdl, ScrollBar*, void);
1455 DECL_LINK(CursorListener, VclWindowEvent&, void);
1457 public:
1458 SalInstanceTextView(VclMultiLineEdit* pTextView, SalInstanceBuilder* pBuilder,
1459 bool bTakeOwnership);
1461 virtual void set_text(const OUString& rText) override;
1463 virtual void replace_selection(const OUString& rText) override;
1465 virtual OUString get_text() const override;
1467 bool get_selection_bounds(int& rStartPos, int& rEndPos) override;
1469 virtual void select_region(int nStartPos, int nEndPos) override;
1471 virtual void set_editable(bool bEditable) override;
1472 virtual bool get_editable() const override;
1473 virtual void set_max_length(int nChars) override;
1475 virtual void set_monospace(bool bMonospace) override;
1477 virtual void set_font(const vcl::Font& rFont) override;
1479 virtual void set_font_color(const Color& rColor) override;
1481 virtual void connect_cursor_position(const Link<TextView&, void>& rLink) override;
1483 virtual bool can_move_cursor_with_up() const override;
1485 virtual bool can_move_cursor_with_down() const override;
1487 virtual void cut_clipboard() override;
1489 virtual void copy_clipboard() override;
1491 virtual void paste_clipboard() override;
1493 virtual void set_alignment(TxtAlign eXAlign) override;
1495 virtual int vadjustment_get_value() const override;
1497 virtual void vadjustment_set_value(int value) override;
1499 virtual int vadjustment_get_upper() const override;
1501 virtual int vadjustment_get_lower() const override;
1503 virtual int vadjustment_get_page_size() const override;
1505 virtual bool has_focus() const override;
1507 virtual ~SalInstanceTextView() override;
1510 struct SalInstanceTreeIter final : public weld::TreeIter
1512 SalInstanceTreeIter(const SalInstanceTreeIter* pOrig)
1513 : iter(pOrig ? pOrig->iter : nullptr)
1516 SalInstanceTreeIter(SvTreeListEntry* pIter)
1517 : iter(pIter)
1520 virtual bool equal(const TreeIter& rOther) const override
1522 return iter == static_cast<const SalInstanceTreeIter&>(rOther).iter;
1524 SvTreeListEntry* iter;
1527 class SalInstanceTreeView : public SalInstanceWidget, public virtual weld::TreeView
1529 protected:
1530 // owner for UserData
1531 std::vector<std::unique_ptr<OUString>> m_aUserData;
1532 VclPtr<SvTabListBox> m_xTreeView;
1533 SvLBoxButtonData m_aCheckButtonData;
1534 SvLBoxButtonData m_aRadioButtonData;
1535 // currently expanding parent that logically, but not currently physically,
1536 // contain placeholders
1537 o3tl::sorted_vector<SvTreeListEntry*> m_aExpandingPlaceHolderParents;
1538 // which columns should be custom rendered
1539 o3tl::sorted_vector<int> m_aCustomRenders;
1540 bool m_bTogglesAsRadio;
1541 int m_nSortColumn;
1543 DECL_LINK(SelectHdl, SvTreeListBox*, void);
1544 DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
1545 DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
1546 DECL_LINK(ExpandingHdl, SvTreeListBox*, bool);
1547 DECL_LINK(EndDragHdl, HeaderBar*, void);
1548 DECL_LINK(HeaderBarClickedHdl, HeaderBar*, void);
1549 DECL_LINK(ToggleHdl, SvLBoxButtonData*, void);
1550 DECL_LINK(ModelChangedHdl, SvTreeListBox*, void);
1551 DECL_LINK(StartDragHdl, SvTreeListBox*, bool);
1552 DECL_STATIC_LINK(SalInstanceTreeView, FinishDragHdl, SvTreeListBox*, void);
1553 DECL_LINK(EditingEntryHdl, SvTreeListEntry*, bool);
1554 DECL_LINK(EditedEntryHdl, const IterString&, bool);
1555 DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void);
1556 DECL_LINK(CompareHdl, const SvSortData&, sal_Int32);
1557 DECL_LINK(PopupMenuHdl, const CommandEvent&, bool);
1558 DECL_LINK(TooltipHdl, SvTreeListEntry*, OUString);
1559 DECL_LINK(CustomRenderHdl, svtree_render_args, void);
1560 DECL_LINK(CustomMeasureHdl, svtree_measure_args, Size);
1562 bool ExpandRow(const SalInstanceTreeIter& rIter);
1564 // Each row has a cell for the expander image, (and an optional cell for a
1565 // checkbutton if enable_toggle_buttons has been called) which precede
1566 // index 0
1567 int to_internal_model(int col) const;
1569 int to_external_model(int col) const;
1571 bool IsDummyEntry(SvTreeListEntry* pEntry) const;
1573 SvTreeListEntry* GetPlaceHolderChild(SvTreeListEntry* pEntry) const;
1575 static void set_font_color(SvTreeListEntry* pEntry, const Color& rColor);
1577 void AddStringItem(SvTreeListEntry* pEntry, const OUString& rStr, int nCol);
1579 void do_insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
1580 const OUString* pId, const OUString* pIconName,
1581 const VirtualDevice* pImageSurface, bool bChildrenOnDemand, weld::TreeIter* pRet,
1582 bool bIsSeparator);
1584 void update_checkbutton_column_width(SvTreeListEntry* pEntry);
1586 void InvalidateModelEntry(SvTreeListEntry* pEntry);
1588 void do_set_toggle(SvTreeListEntry* pEntry, TriState eState, int col);
1590 static TriState do_get_toggle(SvTreeListEntry* pEntry, int col);
1591 static bool do_get_sensitive(SvTreeListEntry* pEntry, int col);
1593 TriState get_toggle(SvTreeListEntry* pEntry, int col) const;
1595 void set_toggle(SvTreeListEntry* pEntry, TriState eState, int col);
1597 bool get_text_emphasis(SvTreeListEntry* pEntry, int col) const;
1599 void set_header_item_width(const std::vector<int>& rWidths);
1601 public:
1602 SalInstanceTreeView(SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1604 virtual void connect_query_tooltip(const Link<const weld::TreeIter&, OUString>& rLink) override;
1606 virtual void columns_autosize() override;
1608 virtual void freeze() override;
1610 virtual void thaw() override;
1612 virtual void set_column_fixed_widths(const std::vector<int>& rWidths) override;
1614 virtual void set_column_editables(const std::vector<bool>& rEditables) override;
1616 virtual void set_centered_column(int nCol) override;
1618 virtual int get_column_width(int nColumn) const override;
1620 virtual OUString get_column_title(int nColumn) const override;
1622 virtual void set_column_title(int nColumn, const OUString& rTitle) override;
1624 virtual void set_column_custom_renderer(int nColumn, bool bEnable) override;
1626 virtual void queue_draw() override;
1628 virtual void show() override;
1630 virtual void hide() override;
1632 virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
1633 const OUString* pId, const OUString* pIconName,
1634 VirtualDevice* pImageSurface, bool bChildrenOnDemand,
1635 weld::TreeIter* pRet) override;
1637 virtual void insert_separator(int pos, const OUString& /*rId*/) override;
1639 virtual void bulk_insert_for_each(
1640 int nSourceCount, const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
1641 const weld::TreeIter* pParent = nullptr, const std::vector<int>* pFixedWidths = nullptr,
1642 bool bGoingToSetText = false) override;
1644 virtual void set_font_color(int pos, const Color& rColor) override;
1646 virtual void set_font_color(const weld::TreeIter& rIter, const Color& rColor) override;
1648 virtual void remove(int pos) override;
1650 virtual int find_text(const OUString& rText) const override;
1652 virtual int find_id(const OUString& rId) const override;
1654 virtual void swap(int pos1, int pos2) override;
1656 virtual void clear() override;
1658 virtual int n_children() const override;
1660 virtual int iter_n_children(const weld::TreeIter& rIter) const override;
1662 virtual void select(int pos) override;
1664 virtual int get_cursor_index() const override;
1666 virtual void set_cursor(int pos) override;
1668 virtual void scroll_to_row(int pos) override;
1670 virtual bool is_selected(int pos) const override;
1672 virtual void unselect(int pos) override;
1674 virtual std::vector<int> get_selected_rows() const override;
1676 OUString get_text(SvTreeListEntry* pEntry, int col) const;
1678 virtual OUString get_text(int pos, int col = -1) const override;
1680 void set_text(SvTreeListEntry* pEntry, const OUString& rText, int col);
1682 virtual void set_text(int pos, const OUString& rText, int col = -1) override;
1684 using SalInstanceWidget::set_sensitive;
1685 using SalInstanceWidget::get_sensitive;
1687 void set_sensitive(SvTreeListEntry* pEntry, bool bSensitive, int col);
1688 bool get_sensitive(SvTreeListEntry* pEntry, int col) const;
1690 virtual void set_sensitive(int pos, bool bSensitive, int col = -1) override;
1692 virtual void set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col = -1) override;
1694 virtual bool get_sensitive(int pos, int col) const override;
1696 virtual bool get_sensitive(const weld::TreeIter& rIter, int col) const override;
1698 virtual TriState get_toggle(int pos, int col = -1) const override;
1700 virtual TriState get_toggle(const weld::TreeIter& rIter, int col = -1) const override;
1702 virtual void enable_toggle_buttons(weld::ColumnToggleType eType) override;
1704 virtual void set_toggle(int pos, TriState eState, int col = -1) override;
1706 virtual void set_toggle(const weld::TreeIter& rIter, TriState eState, int col = -1) override;
1708 virtual void set_clicks_to_toggle(int nToggleBehavior) override;
1710 virtual void set_extra_row_indent(const weld::TreeIter& rIter, int nIndentLevel) override;
1712 void set_text_emphasis(SvTreeListEntry* pEntry, bool bOn, int col = -1);
1714 virtual void set_text_emphasis(const weld::TreeIter& rIter, bool bOn, int col) override;
1716 virtual void set_text_emphasis(int pos, bool bOn, int col) override;
1718 virtual bool get_text_emphasis(const weld::TreeIter& rIter, int col) const override;
1720 virtual bool get_text_emphasis(int pos, int col) const override;
1722 void set_text_align(SvTreeListEntry* pEntry, double fAlign, int col);
1724 virtual void set_text_align(const weld::TreeIter& rIter, double fAlign, int col) override;
1726 virtual void set_text_align(int pos, double fAlign, int col) override;
1728 virtual void connect_editing(const Link<const weld::TreeIter&, bool>& rStartLink,
1729 const Link<const iter_string&, bool>& rEndLink) override;
1731 virtual void start_editing(const weld::TreeIter& rIter) override;
1733 virtual void end_editing() override;
1735 void set_image(SvTreeListEntry* pEntry, const Image& rImage, int col);
1737 virtual void set_image(int pos, const OUString& rImage, int col = -1) override;
1739 virtual void set_image(int pos, const css::uno::Reference<css::graphic::XGraphic>& rImage,
1740 int col = -1) override;
1742 virtual void set_image(int pos, VirtualDevice& rImage, int col = -1) override;
1744 virtual void set_image(const weld::TreeIter& rIter, const OUString& rImage,
1745 int col = -1) override;
1747 virtual void set_image(const weld::TreeIter& rIter,
1748 const css::uno::Reference<css::graphic::XGraphic>& rImage,
1749 int col = -1) override;
1751 virtual void set_image(const weld::TreeIter& rIter, VirtualDevice& rImage,
1752 int col = -1) override;
1754 const OUString* getEntryData(int index) const;
1756 virtual OUString get_id(int pos) const override;
1758 void set_id(SvTreeListEntry* pEntry, const OUString& rId);
1760 virtual void set_id(int pos, const OUString& rId) override;
1762 virtual int get_selected_index() const override;
1764 virtual OUString get_selected_text() const override;
1766 virtual OUString get_selected_id() const override;
1768 virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig
1769 = nullptr) const override;
1771 virtual void copy_iterator(const weld::TreeIter& rSource, weld::TreeIter& rDest) const override;
1773 virtual bool get_selected(weld::TreeIter* pIter) const override;
1775 virtual bool get_cursor(weld::TreeIter* pIter) const override;
1777 virtual void set_cursor(const weld::TreeIter& rIter) override;
1779 virtual bool get_iter_first(weld::TreeIter& rIter) const override;
1781 bool get_iter_abs_pos(weld::TreeIter& rIter, int nPos) const;
1783 virtual bool iter_next_sibling(weld::TreeIter& rIter) const override;
1785 virtual bool iter_previous_sibling(weld::TreeIter& rIter) const override;
1787 virtual bool iter_next(weld::TreeIter& rIter) const override;
1789 virtual bool iter_previous(weld::TreeIter& rIter) const override;
1791 virtual bool iter_children(weld::TreeIter& rIter) const override;
1793 virtual bool iter_parent(weld::TreeIter& rIter) const override;
1795 virtual void remove(const weld::TreeIter& rIter) override;
1797 virtual void select(const weld::TreeIter& rIter) override;
1799 virtual void scroll_to_row(const weld::TreeIter& rIter) override;
1801 virtual void unselect(const weld::TreeIter& rIter) override;
1803 virtual int get_iter_depth(const weld::TreeIter& rIter) const override;
1805 virtual bool iter_has_child(const weld::TreeIter& rIter) const override;
1807 virtual bool get_row_expanded(const weld::TreeIter& rIter) const override;
1809 virtual bool get_children_on_demand(const weld::TreeIter& rIter) const override;
1811 virtual void set_children_on_demand(const weld::TreeIter& rIter,
1812 bool bChildrenOnDemand) override;
1814 virtual void expand_row(const weld::TreeIter& rIter) override;
1816 virtual void collapse_row(const weld::TreeIter& rIter) override;
1818 virtual OUString get_text(const weld::TreeIter& rIter, int col = -1) const override;
1820 virtual void set_text(const weld::TreeIter& rIter, const OUString& rText,
1821 int col = -1) override;
1823 virtual OUString get_id(const weld::TreeIter& rIter) const override;
1825 virtual void set_id(const weld::TreeIter& rIter, const OUString& rId) override;
1827 virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rHelper,
1828 sal_uInt8 eDNDConstants) override;
1830 virtual void set_selection_mode(SelectionMode eMode) override;
1832 virtual void all_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
1834 virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
1836 virtual void visible_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
1838 virtual void connect_visible_range_changed(const Link<weld::TreeView&, void>& rLink) override;
1840 virtual void remove_selection() override;
1842 virtual bool is_selected(const weld::TreeIter& rIter) const override;
1844 virtual int get_iter_index_in_parent(const weld::TreeIter& rIter) const override;
1846 virtual int iter_compare(const weld::TreeIter& a, const weld::TreeIter& b) const override;
1848 virtual void move_subtree(weld::TreeIter& rNode, const weld::TreeIter* pNewParent,
1849 int nIndexInNewParent) override;
1851 virtual int count_selected_rows() const override;
1853 virtual int get_height_rows(int nRows) const override;
1855 virtual void make_sorted() override;
1857 virtual void set_sort_func(
1858 const std::function<int(const weld::TreeIter&, const weld::TreeIter&)>& func) override;
1860 virtual void make_unsorted() override;
1862 virtual void set_sort_order(bool bAscending) override;
1864 virtual bool get_sort_order() const override;
1866 virtual void set_sort_indicator(TriState eState, int col) override;
1868 virtual TriState get_sort_indicator(int col) const override;
1870 virtual int get_sort_column() const override;
1872 virtual void set_sort_column(int nColumn) override;
1874 SvTabListBox& getTreeView();
1876 virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult, bool bDnDMode,
1877 bool bAutoScroll = true) override;
1879 virtual void unset_drag_dest_row() override;
1881 virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const override;
1883 virtual TreeView* get_drag_source() const override;
1885 virtual int vadjustment_get_value() const override;
1887 virtual void vadjustment_set_value(int nValue) override;
1889 virtual void set_show_expanders(bool bShow) override;
1891 virtual bool changed_by_hover() const override;
1893 virtual ~SalInstanceTreeView() override;
1896 class SalInstanceExpander : public SalInstanceWidget, public virtual weld::Expander
1898 private:
1899 VclPtr<VclExpander> m_xExpander;
1901 DECL_LINK(ExpandedHdl, VclExpander&, void);
1903 public:
1904 SalInstanceExpander(VclExpander* pExpander, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1906 virtual void set_label(const OUString& rText) override;
1908 virtual OUString get_label() const override;
1910 virtual bool get_expanded() const override;
1912 virtual void set_expanded(bool bExpand) override;
1914 virtual bool has_focus() const override;
1916 virtual void grab_focus() override;
1918 virtual ~SalInstanceExpander() override;
1921 class SalInstanceIconView : public SalInstanceWidget, public virtual weld::IconView
1923 protected:
1924 VclPtr<::IconView> m_xIconView;
1926 private:
1927 // owner for UserData
1928 std::vector<std::unique_ptr<OUString>> m_aUserData;
1930 DECL_LINK(SelectHdl, SvTreeListBox*, void);
1931 DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
1932 DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
1933 DECL_LINK(CommandHdl, const CommandEvent&, bool);
1934 DECL_LINK(TooltipHdl, SvTreeListEntry*, OUString);
1935 DECL_LINK(EntryAccessibleDescriptionHdl, SvTreeListEntry*, OUString);
1936 DECL_LINK(DumpImageHdl, const ::IconView::encoded_image_query&, bool);
1938 public:
1939 SalInstanceIconView(::IconView* pIconView, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1941 virtual int get_item_width() const override;
1942 virtual void set_item_width(int width) override;
1944 virtual void freeze() override;
1946 virtual void thaw() override;
1948 virtual void insert(int pos, const OUString* pStr, const OUString* pId,
1949 const OUString* pIconName, weld::TreeIter* pRet) override;
1951 virtual void insert(int pos, const OUString* pStr, const OUString* pId,
1952 const VirtualDevice* pIcon, weld::TreeIter* pRet) override;
1954 virtual void insert_separator(int pos, const OUString* pId) override;
1956 virtual void connect_query_tooltip(const Link<const weld::TreeIter&, OUString>& rLink) override;
1958 virtual void
1959 connect_get_image(const Link<const weld::encoded_image_query&, bool>& rLink) override;
1961 virtual OUString get_selected_id() const override;
1963 virtual OUString get_selected_text() const override;
1965 virtual int count_selected_items() const override;
1967 virtual void select(int pos) override;
1969 virtual void unselect(int pos) override;
1971 virtual int n_children() const override;
1973 virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig
1974 = nullptr) const override;
1976 virtual bool get_selected(weld::TreeIter* pIter) const override;
1978 virtual bool get_cursor(weld::TreeIter* pIter) const override;
1980 virtual void set_cursor(const weld::TreeIter& rIter) override;
1982 virtual bool get_iter_first(weld::TreeIter& rIter) const override;
1984 virtual bool iter_next_sibling(weld::TreeIter& rIter) const override;
1986 virtual void scroll_to_item(const weld::TreeIter& rIter) override;
1988 virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
1990 virtual OUString get_id(const weld::TreeIter& rIter) const override;
1992 virtual OUString get_id(int pos) const override;
1994 virtual void remove(int pos) override;
1996 const OUString* getEntryData(int index) const;
1998 virtual void set_image(int pos, VirtualDevice* rImage) override;
2000 virtual void set_text(int pos, const OUString& rText) override;
2002 virtual void set_id(int pos, const OUString& rId) override;
2004 virtual OUString get_text(const weld::TreeIter& rIter) const override;
2006 virtual tools::Rectangle get_rect(int pos) const override;
2008 virtual void clear() override;
2010 virtual ~SalInstanceIconView() override;
2013 class SalInstanceRadioButton : public SalInstanceButton, public virtual weld::RadioButton
2015 private:
2016 VclPtr<::RadioButton> m_xRadioButton;
2018 DECL_LINK(ToggleHdl, ::RadioButton&, void);
2020 public:
2021 SalInstanceRadioButton(::RadioButton* pButton, SalInstanceBuilder* pBuilder,
2022 bool bTakeOwnership);
2024 virtual void set_active(bool active) override;
2026 virtual bool get_active() const override;
2028 virtual void set_image(VirtualDevice* pDevice) override;
2030 virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override;
2032 virtual void set_from_icon_name(const OUString& rIconName) override;
2034 virtual void set_inconsistent(bool /*inconsistent*/) override;
2036 virtual bool get_inconsistent() const override;
2038 virtual void set_label(const OUString& rText) override { SalInstanceButton::set_label(rText); }
2040 virtual OUString get_label() const override { return SalInstanceButton::get_label(); }
2042 virtual void set_label_wrap(bool wrap) override;
2044 virtual ~SalInstanceRadioButton() override;
2047 class SalInstanceFrame : public SalInstanceContainer, public virtual weld::Frame
2049 private:
2050 VclPtr<VclFrame> m_xFrame;
2052 public:
2053 SalInstanceFrame(VclFrame* pFrame, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
2055 virtual void set_label(const OUString& rText) override;
2057 virtual OUString get_label() const override;
2059 virtual std::unique_ptr<weld::Label> weld_label_widget() const override;
2062 class SalInstanceMenuButton : public SalInstanceButton, public virtual weld::MenuButton
2064 protected:
2065 VclPtr<::MenuButton> m_xMenuButton;
2066 sal_uInt16 m_nLastId;
2068 DECL_LINK(MenuSelectHdl, ::MenuButton*, void);
2069 DECL_LINK(ActivateHdl, ::MenuButton*, void);
2071 public:
2072 SalInstanceMenuButton(::MenuButton* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
2074 virtual void set_active(bool active) override;
2076 virtual bool get_active() const override;
2078 virtual void set_inconsistent(bool /*inconsistent*/) override;
2080 virtual bool get_inconsistent() const override;
2082 virtual void insert_item(int pos, const OUString& rId, const OUString& rStr,
2083 const OUString* pIconName, VirtualDevice* pImageSurface,
2084 TriState eCheckRadioFalse) override;
2086 virtual void insert_separator(int pos, const OUString& rId) override;
2088 virtual void set_item_sensitive(const OUString& rIdent, bool bSensitive) override;
2090 virtual void remove_item(const OUString& rId) override;
2092 virtual void clear() override;
2094 virtual void set_item_active(const OUString& rIdent, bool bActive) override;
2096 virtual void set_item_label(const OUString& rIdent, const OUString& rText) override;
2098 virtual OUString get_item_label(const OUString& rIdent) const override;
2100 virtual void set_item_visible(const OUString& rIdent, bool bShow) override;
2102 virtual void set_popover(weld::Widget* pPopover) override;
2104 virtual ~SalInstanceMenuButton() override;
2107 class SalInstancePopover : public SalInstanceContainer, public virtual weld::Popover
2109 private:
2110 VclPtr<DockingWindow> m_xPopover;
2112 DECL_LINK(PopupModeEndHdl, FloatingWindow*, void);
2114 void ImplPopDown();
2116 public:
2117 SalInstancePopover(DockingWindow* pPopover, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
2119 ~SalInstancePopover();
2121 virtual void popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect,
2122 weld::Placement ePlace = weld::Placement::Under) override;
2124 virtual void popdown() override;
2126 virtual void resize_to_request() override;
2129 class SalInstanceBox : public SalInstanceContainer, public virtual weld::Box
2131 private:
2132 VclPtr<VclBox> m_xBox;
2134 public:
2135 SalInstanceBox(VclBox* pContainer, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
2136 virtual void reorder_child(weld::Widget* pWidget, int nNewPosition) override;
2137 virtual void sort_native_button_order() override;
2140 class SalInstanceImage : public SalInstanceWidget, public virtual weld::Image
2142 private:
2143 VclPtr<FixedImage> m_xImage;
2145 public:
2146 SalInstanceImage(FixedImage* pImage, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
2148 virtual void set_from_icon_name(const OUString& rIconName) override;
2150 virtual void set_image(VirtualDevice* pDevice) override;
2152 virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override;
2155 class SalInstanceScrolledWindow : public SalInstanceContainer, public virtual weld::ScrolledWindow
2157 private:
2158 VclPtr<VclScrolledWindow> m_xScrolledWindow;
2159 Link<ScrollBar*, void> m_aOrigVScrollHdl;
2160 Link<ScrollBar*, void> m_aOrigHScrollHdl;
2161 bool m_bUserManagedScrolling;
2163 DECL_LINK(VscrollHdl, ScrollBar*, void);
2164 DECL_LINK(HscrollHdl, ScrollBar*, void);
2166 static void customize_scrollbars(ScrollBar& rScrollBar, const Color& rButtonTextColor,
2167 const Color& rBackgroundColor, const Color& rShadowColor,
2168 const Color& rFaceColor);
2170 public:
2171 SalInstanceScrolledWindow(VclScrolledWindow* pScrolledWindow, SalInstanceBuilder* pBuilder,
2172 bool bTakeOwnership, bool bUserManagedScrolling);
2174 virtual void hadjustment_configure(int value, int lower, int upper, int step_increment,
2175 int page_increment, int page_size) override;
2176 virtual int hadjustment_get_value() const override;
2177 virtual void hadjustment_set_value(int value) override;
2178 virtual int hadjustment_get_upper() const override;
2179 virtual void hadjustment_set_upper(int upper) override;
2180 virtual int hadjustment_get_page_size() const override;
2181 virtual void hadjustment_set_page_size(int size) override;
2182 virtual void hadjustment_set_page_increment(int size) override;
2183 virtual void hadjustment_set_step_increment(int size) override;
2184 virtual void set_hpolicy(VclPolicyType eHPolicy) override;
2185 virtual VclPolicyType get_hpolicy() const override;
2187 virtual void vadjustment_configure(int value, int lower, int upper, int step_increment,
2188 int page_increment, int page_size) override;
2189 virtual int vadjustment_get_value() const override;
2190 virtual void vadjustment_set_value(int value) override;
2191 virtual int vadjustment_get_upper() const override;
2192 virtual void vadjustment_set_upper(int upper) override;
2193 virtual int vadjustment_get_lower() const override;
2194 virtual void vadjustment_set_lower(int lower) override;
2195 virtual int vadjustment_get_page_size() const override;
2196 virtual void vadjustment_set_page_size(int size) override;
2197 virtual void vadjustment_set_page_increment(int size) override;
2198 virtual void vadjustment_set_step_increment(int size) override;
2200 virtual void set_vpolicy(VclPolicyType eVPolicy) override;
2201 virtual VclPolicyType get_vpolicy() const override;
2202 virtual int get_scroll_thickness() const override;
2203 virtual void set_scroll_thickness(int nThickness) override;
2204 virtual void customize_scrollbars(const Color& rBackgroundColor, const Color& rShadowColor,
2205 const Color& rFaceColor) override;
2206 virtual ~SalInstanceScrolledWindow() override;
2209 class SalInstanceLevelBar : public SalInstanceWidget, public virtual weld::LevelBar
2211 private:
2212 VclPtr<::ProgressBar> m_xLevelBar;
2214 public:
2215 SalInstanceLevelBar(::ProgressBar* pLevelBar, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
2216 : SalInstanceWidget(pLevelBar, pBuilder, bTakeOwnership)
2217 , m_xLevelBar(pLevelBar)
2221 virtual void set_percentage(double fPercentage) override
2223 m_xLevelBar->SetValue(static_cast<sal_uInt16>(fPercentage));
2227 class SalInstanceCalendar : public SalInstanceWidget, public virtual weld::Calendar
2229 private:
2230 VclPtr<::Calendar> m_xCalendar;
2232 DECL_LINK(SelectHdl, ::Calendar*, void);
2233 DECL_LINK(ActivateHdl, ::Calendar*, void);
2235 public:
2236 SalInstanceCalendar(::Calendar* pCalendar, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
2237 : SalInstanceWidget(pCalendar, pBuilder, bTakeOwnership)
2238 , m_xCalendar(pCalendar)
2240 m_xCalendar->SetSelectHdl(LINK(this, SalInstanceCalendar, SelectHdl));
2241 m_xCalendar->SetActivateHdl(LINK(this, SalInstanceCalendar, ActivateHdl));
2244 virtual void set_date(const Date& rDate) override { m_xCalendar->SetCurDate(rDate); }
2246 virtual Date get_date() const override { return m_xCalendar->GetFirstSelectedDate(); }
2248 virtual ~SalInstanceCalendar() override
2250 m_xCalendar->SetSelectHdl(Link<::Calendar*, void>());
2251 m_xCalendar->SetActivateHdl(Link<::Calendar*, void>());
2255 class SalInstanceFormattedSpinButton : public SalInstanceEntry,
2256 public virtual weld::FormattedSpinButton
2258 private:
2259 VclPtr<FormattedField> m_xButton;
2260 weld::EntryFormatter* m_pFormatter;
2261 Link<weld::Widget&, void> m_aLoseFocusHdl;
2263 DECL_LINK(UpDownHdl, SpinField&, void);
2264 DECL_LINK(LoseFocusHdl, Control&, void);
2266 public:
2267 SalInstanceFormattedSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder,
2268 bool bTakeOwnership);
2270 virtual void set_text(const OUString& rText) override;
2272 virtual void connect_changed(const Link<weld::Entry&, void>& rLink) override;
2274 virtual void connect_focus_out(const Link<weld::Widget&, void>& rLink) override;
2276 virtual void SetFormatter(weld::EntryFormatter* pFormatter) override;
2278 virtual void sync_value_from_formatter() override
2280 // no-op for gen
2283 virtual void sync_range_from_formatter() override
2285 // no-op for gen
2288 virtual void sync_increments_from_formatter() override
2290 // no-op for gen
2293 virtual Formatter& GetFormatter() override;
2295 virtual ~SalInstanceFormattedSpinButton() override;
2298 class SalInstanceVerticalNotebook : public SalInstanceWidget, public virtual weld::Notebook
2300 private:
2301 VclPtr<VerticalTabControl> m_xNotebook;
2302 /// Constructed on-demand.
2303 mutable std::map<OUString, std::shared_ptr<SalInstanceContainer>> m_aPages;
2305 DECL_LINK(DeactivatePageHdl, VerticalTabControl*, bool);
2306 DECL_LINK(ActivatePageHdl, VerticalTabControl*, void);
2308 public:
2309 SalInstanceVerticalNotebook(VerticalTabControl* pNotebook, SalInstanceBuilder* pBuilder,
2310 bool bTakeOwnership);
2312 virtual int get_current_page() const override;
2314 virtual OUString get_page_ident(int nPage) const override;
2316 virtual OUString get_current_page_ident() const override;
2318 virtual int get_page_index(const OUString& rIdent) const override;
2320 virtual weld::Container* get_page(const OUString& rIdent) const override;
2322 virtual void set_current_page(int nPage) override;
2324 virtual void set_current_page(const OUString& rIdent) override;
2326 virtual void remove_page(const OUString& rIdent) override;
2328 virtual void insert_page(const OUString& rIdent, const OUString& rLabel, int nPos) override;
2330 virtual int get_n_pages() const override;
2332 virtual void set_tab_label_text(const OUString& rIdent, const OUString& rText) override;
2334 virtual OUString get_tab_label_text(const OUString& rIdent) const override;
2336 virtual void set_show_tabs(bool /*bShow*/) override;
2338 virtual ~SalInstanceVerticalNotebook() override;
2341 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */