calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / vcl / inc / salvtables.hxx
blob2fa5dcc713a99135a7b46de6721bb2204b701fc1
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/weld.hxx>
12 #include <vcl/svapp.hxx>
13 #include <vcl/syswin.hxx>
14 #include <vcl/settings.hxx>
15 #include <vcl/virdev.hxx>
16 #include <vcl/ctrl.hxx>
17 #include <vcl/toolkit/edit.hxx>
18 #include <vcl/formatter.hxx>
19 #include <vcl/toolkit/spinfld.hxx>
20 #include <vcl/toolkit/fixed.hxx>
21 #include <vcl/toolkit/fixedhyper.hxx>
22 #include <vcl/toolkit/lstbox.hxx>
23 #include <vcl/toolkit/menubtn.hxx>
24 #include <vcl/toolkit/combobox.hxx>
25 #include <vcl/tabctrl.hxx>
26 #include <vcl/layout.hxx>
27 #include <vcl/toolkit/svtabbx.hxx>
28 #include <vcl/toolkit/svlbitm.hxx>
29 #include <o3tl/sorted_vector.hxx>
30 #include "calendar.hxx"
31 #include "iconview.hxx"
32 #include "listbox.hxx"
33 #include "messagedialog.hxx"
34 #include "verticaltabctrl.hxx"
36 namespace vcl
38 class RoadmapWizard;
41 class SalInstanceBuilder : public weld::Builder
43 protected:
44 std::unique_ptr<VclBuilder> m_xBuilder;
45 VclPtr<vcl::Window> m_aOwnedToplevel;
47 public:
48 SalInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile,
49 const css::uno::Reference<css::frame::XFrame>& rFrame
50 = css::uno::Reference<css::frame::XFrame>());
52 virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OString& id) override;
54 virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString& id) override;
56 virtual std::unique_ptr<weld::Assistant> weld_assistant(const OString& id) override;
58 virtual std::unique_ptr<weld::Window> create_screenshot_window() override;
60 virtual std::unique_ptr<weld::Widget> weld_widget(const OString& id) override;
62 virtual std::unique_ptr<weld::Container> weld_container(const OString& id) override;
64 virtual std::unique_ptr<weld::Box> weld_box(const OString& id) override;
66 virtual std::unique_ptr<weld::Paned> weld_paned(const OString& id) override;
68 virtual std::unique_ptr<weld::Frame> weld_frame(const OString& id) override;
70 virtual std::unique_ptr<weld::ScrolledWindow>
71 weld_scrolled_window(const OString& id, bool bUserManagedScrolling = false) override;
73 virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id) override;
75 virtual std::unique_ptr<weld::Button> weld_button(const OString& id) override;
77 virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OString& id) override;
79 virtual std::unique_ptr<weld::MenuToggleButton>
80 weld_menu_toggle_button(const OString& id) override;
82 virtual std::unique_ptr<weld::LinkButton> weld_link_button(const OString& id) override;
84 virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const OString& id) override;
86 virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OString& id) override;
88 virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OString& id) override;
90 virtual std::unique_ptr<weld::Scale> weld_scale(const OString& id) override;
92 virtual std::unique_ptr<weld::ProgressBar> weld_progress_bar(const OString& id) override;
94 virtual std::unique_ptr<weld::Spinner> weld_spinner(const OString& id) override;
96 virtual std::unique_ptr<weld::Image> weld_image(const OString& id) override;
98 virtual std::unique_ptr<weld::Calendar> weld_calendar(const OString& id) override;
100 virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id) override;
102 virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString& id) override;
104 virtual std::unique_ptr<weld::MetricSpinButton>
105 weld_metric_spin_button(const OString& id, FieldUnit eUnit) override;
107 virtual std::unique_ptr<weld::FormattedSpinButton>
108 weld_formatted_spin_button(const OString& id) override;
110 virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id) override;
112 virtual std::unique_ptr<weld::EntryTreeView>
113 weld_entry_tree_view(const OString& containerid, const OString& entryid,
114 const OString& treeviewid) override;
116 virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString& id) override;
118 virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString& id) override;
120 virtual std::unique_ptr<weld::Label> weld_label(const OString& id) override;
122 virtual std::unique_ptr<weld::TextView> weld_text_view(const OString& id) override;
124 virtual std::unique_ptr<weld::Expander> weld_expander(const OString& id) override;
126 virtual std::unique_ptr<weld::DrawingArea>
127 weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
128 FactoryFunction pUITestFactoryFunction = nullptr,
129 void* pUserData = nullptr) override;
131 virtual std::unique_ptr<weld::Menu> weld_menu(const OString& id) override;
133 virtual std::unique_ptr<weld::Popover> weld_popover(const OString& id) override;
135 virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OString& id) override;
137 virtual std::unique_ptr<weld::Scrollbar> weld_scrollbar(const OString& id) override;
139 virtual std::unique_ptr<weld::SizeGroup> create_size_group() override;
141 OString get_current_page_help_id() const;
143 virtual ~SalInstanceBuilder() override;
146 class SAL_DLLPUBLIC_RTTI SalInstanceMenu final : public weld::Menu
148 private:
149 VclPtr<PopupMenu> m_xMenu;
151 bool m_bTakeOwnership;
152 sal_uInt16 m_nLastId;
154 DECL_DLLPRIVATE_LINK(SelectMenuHdl, ::Menu*, bool);
156 public:
157 SalInstanceMenu(PopupMenu* pMenu, bool bTakeOwnership);
158 virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect,
159 weld::Placement ePlace = weld::Placement::Under) override;
160 virtual void set_sensitive(const OString& rIdent, bool bSensitive) override;
161 virtual bool get_sensitive(const OString& rIdent) const override;
162 virtual void set_active(const OString& rIdent, bool bActive) override;
163 virtual bool get_active(const OString& rIdent) const override;
164 virtual void set_label(const OString& rIdent, const OUString& rLabel) override;
165 virtual OUString get_label(const OString& rIdent) const override;
166 virtual void set_visible(const OString& rIdent, bool bShow) override;
167 virtual void clear() override;
168 virtual void insert(int pos, const OUString& rId, const OUString& rStr,
169 const OUString* pIconName, VirtualDevice* pImageSurface,
170 const css::uno::Reference<css::graphic::XGraphic>& rImage,
171 TriState eCheckRadioFalse) override;
172 virtual void insert_separator(int pos, const OUString& rId) override;
173 virtual void remove(const OString& rId) override;
174 virtual OString get_id(int pos) const override;
175 virtual int n_children() const override;
176 PopupMenu* getMenu() const;
177 virtual ~SalInstanceMenu() override;
180 class SalFlashAttention;
182 class SalInstanceWidget : public virtual weld::Widget
184 protected:
185 VclPtr<vcl::Window> m_xWidget;
186 std::unique_ptr<SalFlashAttention> m_xFlashAttention;
187 SalInstanceBuilder* m_pBuilder;
189 private:
190 DECL_LINK(EventListener, VclWindowEvent&, void);
191 DECL_LINK(KeyEventListener, VclWindowEvent&, bool);
192 DECL_LINK(MouseEventListener, VclWindowEvent&, void);
193 DECL_LINK(MnemonicActivateHdl, vcl::Window&, bool);
195 static void DoRecursivePaint(vcl::Window* pWindow, const Point& rPos, OutputDevice& rOutput);
197 const bool m_bTakeOwnership;
198 bool m_bEventListener;
199 bool m_bKeyEventListener;
200 bool m_bMouseEventListener;
201 int m_nBlockNotify;
202 int m_nFreezeCount;
204 protected:
205 void ensure_event_listener();
207 // we want the ability to mark key events as handled, so use this variant
208 // for those, we get all keystrokes in this case, so we will need to filter
209 // them later
210 void ensure_key_listener();
212 // we want the ability to know about mouse events that happen in our children
213 // so use this variant, we will need to filter them later
214 void ensure_mouse_listener();
216 bool IsFirstFreeze() const { return m_nFreezeCount == 0; }
217 bool IsLastThaw() const { return m_nFreezeCount == 1; }
219 virtual void HandleEventListener(VclWindowEvent& rEvent);
220 virtual bool HandleKeyEventListener(VclWindowEvent& rEvent);
221 virtual void HandleMouseEventListener(VclWindowEvent& rEvent);
223 public:
224 SalInstanceWidget(vcl::Window* pWidget, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
226 virtual void set_sensitive(bool sensitive) override;
228 virtual bool get_sensitive() const override;
230 virtual bool get_visible() const override;
232 virtual bool is_visible() const override;
234 virtual void set_can_focus(bool bCanFocus) override;
236 virtual void grab_focus() override;
238 virtual bool has_focus() const override;
240 virtual bool is_active() const override;
242 virtual bool has_child_focus() const override;
244 virtual void show() override;
246 virtual void hide() override;
248 virtual void set_size_request(int nWidth, int nHeight) override;
250 virtual Size get_size_request() const override;
252 virtual Size get_preferred_size() const override;
254 virtual float get_approximate_digit_width() const override;
256 virtual int get_text_height() const override;
258 virtual Size get_pixel_size(const OUString& rText) const override;
260 virtual vcl::Font get_font() override;
262 virtual OString get_buildable_name() const override;
264 virtual void set_buildable_name(const OString& rId) override;
266 virtual void set_help_id(const OString& rId) override;
268 virtual OString get_help_id() const override;
270 virtual void set_grid_left_attach(int nAttach) override;
272 virtual int get_grid_left_attach() const override;
274 virtual void set_grid_width(int nCols) override;
276 virtual void set_grid_top_attach(int nAttach) override;
278 virtual int get_grid_top_attach() const override;
280 virtual void set_hexpand(bool bExpand) override;
282 virtual bool get_hexpand() const override;
284 virtual void set_vexpand(bool bExpand) override;
286 virtual bool get_vexpand() const override;
288 virtual void set_margin_top(int nMargin) override;
290 virtual void set_margin_bottom(int nMargin) override;
292 virtual void set_margin_start(int nMargin) override;
294 virtual void set_margin_end(int nMargin) override;
296 virtual int get_margin_top() const override;
298 virtual int get_margin_bottom() const override;
300 virtual int get_margin_start() const override;
302 virtual int get_margin_end() const override;
304 virtual void set_accessible_name(const OUString& rName) override;
306 virtual void set_accessible_description(const OUString& rDescription) override;
308 virtual OUString get_accessible_name() const override;
310 virtual OUString get_accessible_description() const override;
312 virtual void set_accessible_relation_labeled_by(weld::Widget* pLabel) override;
314 virtual void set_tooltip_text(const OUString& rTip) override;
316 virtual OUString get_tooltip_text() const override;
318 virtual void set_cursor_data(void* pData) override;
320 virtual void connect_focus_in(const Link<Widget&, void>& rLink) override;
322 virtual void connect_mnemonic_activate(const Link<Widget&, bool>& rLink) override;
324 virtual void connect_focus_out(const Link<Widget&, void>& rLink) override;
326 virtual void connect_size_allocate(const Link<const Size&, void>& rLink) override;
328 virtual void connect_mouse_press(const Link<const MouseEvent&, bool>& rLink) override;
330 virtual void connect_mouse_move(const Link<const MouseEvent&, bool>& rLink) override;
332 virtual void connect_mouse_release(const Link<const MouseEvent&, bool>& rLink) override;
334 virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override;
336 virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink) override;
338 virtual bool get_extents_relative_to(const Widget& rRelative, int& x, int& y, int& width,
339 int& height) const override;
341 virtual void grab_add() override;
343 virtual bool has_grab() const override;
345 virtual void grab_remove() override;
347 virtual bool get_direction() const override;
349 virtual void set_direction(bool bRTL) override;
351 virtual void freeze() override;
353 virtual void thaw() override;
355 virtual void set_busy_cursor(bool bBusy) override;
357 virtual std::unique_ptr<weld::Container> weld_parent() const override;
359 virtual ~SalInstanceWidget() override;
361 vcl::Window* getWidget() const;
363 void disable_notify_events();
365 bool notify_events_disabled() const;
367 void enable_notify_events();
369 virtual void queue_resize() override;
371 virtual void help_hierarchy_foreach(const std::function<bool(const OString&)>& func) override;
373 virtual OUString strip_mnemonic(const OUString& rLabel) const override;
375 virtual VclPtr<VirtualDevice> create_virtual_device() const override;
377 virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() override;
378 virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard>
379 get_clipboard() const override;
381 virtual void connect_get_property_tree(const Link<tools::JsonWriter&, void>& rLink) override;
383 virtual void get_property_tree(tools::JsonWriter& rJsonWriter) override;
385 virtual void call_attention_to() override;
387 virtual void set_stack_background() override;
389 virtual void set_title_background() override;
391 virtual void set_toolbar_background() override;
393 virtual void set_highlight_background() override;
395 virtual void set_background(const Color& rColor) override;
397 virtual void draw(OutputDevice& rOutput, const Point& rPos, const Size& rSizePixel) override;
399 SystemWindow* getSystemWindow();
402 class SalInstanceLabel : public SalInstanceWidget, public virtual weld::Label
404 private:
405 // Control instead of FixedText so we can also use this for
406 // SelectableFixedText which is derived from Edit. We just typically need
407 // [G|S]etText which exists in their shared baseclass
408 VclPtr<Control> m_xLabel;
410 public:
411 SalInstanceLabel(Control* pLabel, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
413 virtual void set_label(const OUString& rText) override;
415 virtual OUString get_label() const override;
417 virtual void set_mnemonic_widget(Widget* pTarget) override;
419 virtual void set_label_type(weld::LabelType eType) override;
421 virtual void set_font(const vcl::Font& rFont) override;
423 virtual void set_font_color(const Color& rColor) override;
426 class SalInstanceContainer : public SalInstanceWidget, public virtual weld::Container
428 VclPtr<vcl::Window> m_xContainer;
430 public:
431 SalInstanceContainer(vcl::Window* pContainer, SalInstanceBuilder* pBuilder,
432 bool bTakeOwnership);
433 virtual void HandleEventListener(VclWindowEvent& rEvent) override;
434 virtual void connect_container_focus_changed(const Link<Container&, void>& rLink) override;
435 virtual void child_grab_focus() override;
436 virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) override;
437 virtual css::uno::Reference<css::awt::XWindow> CreateChildFrame() override;
440 class SalInstanceWindow : public SalInstanceContainer, public virtual weld::Window
442 private:
443 VclPtr<vcl::Window> m_xWindow;
445 DECL_LINK(HelpHdl, vcl::Window&, bool);
447 void override_child_help(vcl::Window* pParent);
449 void clear_child_help(vcl::Window* pParent);
451 void recursively_unset_default_buttons();
453 void implResetDefault(const vcl::Window* _pWindow);
455 public:
456 SalInstanceWindow(vcl::Window* pWindow, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
458 virtual void set_title(const OUString& rTitle) override;
460 virtual OUString get_title() const override;
462 void help();
464 virtual css::uno::Reference<css::awt::XWindow> GetXWindow() override;
466 virtual void resize_to_request() override;
468 virtual void set_modal(bool bModal) override;
470 virtual bool get_modal() const override;
472 virtual void window_move(int x, int y) override;
474 virtual Size get_size() const override;
476 virtual Point get_position() const override;
478 virtual tools::Rectangle get_monitor_workarea() const override;
480 virtual void set_centered_on_parent(bool /*bTrackGeometryRequests*/) override;
482 virtual bool get_resizable() const override;
484 virtual bool has_toplevel_focus() const override;
486 virtual void present() override;
488 virtual void change_default_widget(weld::Widget* pOld, weld::Widget* pNew) override;
490 virtual bool is_default_widget(const weld::Widget* pCandidate) const override;
492 virtual void set_window_state(const OString& rStr) override;
494 virtual OString get_window_state(vcl::WindowDataMask nMask) const override;
496 virtual SystemEnvData get_system_data() const override;
498 virtual weld::ScreenShotCollection collect_screenshot_data() override;
500 virtual VclPtr<VirtualDevice> screenshot() override;
502 virtual const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() override;
504 virtual ~SalInstanceWindow() override;
507 class SalInstanceDialog : public SalInstanceWindow, public virtual weld::Dialog
509 protected:
510 VclPtr<::Dialog> m_xDialog;
512 private:
513 // for calc ref dialog that shrink to range selection widgets and resize back
514 VclPtr<vcl::Window> m_xRefEdit;
515 std::vector<VclPtr<vcl::Window>> m_aHiddenWidgets; // vector of hidden Controls
516 tools::Long m_nOldEditWidthReq; // Original width request of the input field
517 sal_Int32 m_nOldBorderWidth; // border width for expanded dialog
519 DECL_LINK(PopupScreenShotMenuHdl, const CommandEvent&, bool);
521 public:
522 SalInstanceDialog(::Dialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
524 virtual bool runAsync(std::shared_ptr<weld::DialogController> aOwner,
525 const std::function<void(sal_Int32)>& rEndDialogFn) override;
527 virtual bool runAsync(std::shared_ptr<Dialog> const& rxSelf,
528 const std::function<void(sal_Int32)>& rEndDialogFn) override;
530 virtual void collapse(weld::Widget* pEdit, weld::Widget* pButton) override;
532 virtual void undo_collapse() override;
534 virtual void
535 SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink) override;
537 virtual int run() override;
539 virtual void response(int nResponse) override;
541 virtual void add_button(const OUString& rText, int nResponse,
542 const OString& rHelpId = OString()) override;
544 virtual void set_modal(bool bModal) override;
546 virtual bool get_modal() const override;
548 virtual weld::Button* weld_widget_for_response(int nResponse) override;
550 virtual void set_default_response(int nResponse) override;
552 virtual weld::Container* weld_content_area() override;
555 class SalInstanceAssistant : public SalInstanceDialog, public virtual weld::Assistant
557 protected:
558 VclPtr<vcl::RoadmapWizard> m_xWizard;
560 private:
561 std::vector<std::unique_ptr<SalInstanceContainer>> m_aPages;
562 std::vector<VclPtr<TabPage>> m_aAddedPages;
563 std::vector<int> m_aIds;
564 std::vector<VclPtr<VclGrid>> m_aAddedGrids;
565 Idle m_aUpdateRoadmapIdle;
567 int find_page(std::string_view rIdent) const;
568 int find_id(int nId) const;
570 DECL_LINK(OnRoadmapItemSelected, LinkParamNone*, void);
571 DECL_LINK(UpdateRoadmap_Hdl, Timer*, void);
573 public:
574 SalInstanceAssistant(vcl::RoadmapWizard* pDialog, SalInstanceBuilder* pBuilder,
575 bool bTakeOwnership);
576 virtual int get_current_page() const override;
577 virtual int get_n_pages() const override;
578 virtual OString get_page_ident(int nPage) const override;
579 virtual OString get_current_page_ident() const override;
580 virtual void set_current_page(int nPage) override;
581 virtual void set_current_page(const OString& rIdent) override;
582 virtual void set_page_index(const OString& rIdent, int nNewIndex) override;
583 virtual weld::Container* append_page(const OString& rIdent) override;
584 virtual OUString get_page_title(const OString& rIdent) const override;
585 virtual void set_page_title(const OString& rIdent, const OUString& rTitle) override;
586 virtual void set_page_sensitive(const OString& rIdent, bool bSensitive) override;
587 virtual void set_page_side_help_id(const OString& rHelpId) override;
588 virtual void set_page_side_image(const OUString& rImage) override;
589 weld::Button* weld_widget_for_response(int nResponse) override;
591 virtual ~SalInstanceAssistant() override;
594 class WeldTextFilter final : public TextFilter
596 private:
597 Link<OUString&, bool>& m_rInsertTextHdl;
599 public:
600 WeldTextFilter(Link<OUString&, bool>& rInsertTextHdl);
602 virtual OUString filter(const OUString& rText) override;
605 class SalInstanceEntry : public SalInstanceWidget, public virtual weld::Entry
607 private:
608 VclPtr<::Edit> m_xEntry;
610 DECL_LINK(ChangeHdl, Edit&, void);
611 DECL_LINK(CursorListener, VclWindowEvent&, void);
612 DECL_LINK(ActivateHdl, Edit&, bool);
614 WeldTextFilter m_aTextFilter;
616 public:
617 SalInstanceEntry(::Edit* pEntry, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
619 virtual void set_text(const OUString& rText) override;
621 virtual OUString get_text() const override;
623 virtual void set_width_chars(int nChars) override;
625 virtual int get_width_chars() const override;
627 virtual void set_max_length(int nChars) override;
629 virtual void select_region(int nStartPos, int nEndPos) override;
631 bool get_selection_bounds(int& rStartPos, int& rEndPos) override;
633 virtual void replace_selection(const OUString& rText) override;
635 virtual void set_position(int nCursorPos) override;
637 virtual int get_position() const override;
639 virtual void set_editable(bool bEditable) override;
641 virtual bool get_editable() const override;
643 virtual void set_overwrite_mode(bool bOn) override;
645 virtual bool get_overwrite_mode() const override;
647 virtual void set_message_type(weld::EntryMessageType eType) override;
649 virtual void set_font(const vcl::Font& rFont) override;
651 virtual void set_font_color(const Color& rColor) override;
653 virtual void connect_cursor_position(const Link<Entry&, void>& rLink) override;
655 virtual void set_placeholder_text(const OUString& rText) override;
657 Edit& getEntry();
659 void fire_signal_changed();
661 virtual void cut_clipboard() override;
663 virtual void copy_clipboard() override;
665 virtual void paste_clipboard() override;
667 virtual void set_alignment(TxtAlign eXAlign) override;
669 virtual ~SalInstanceEntry() override;
672 class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton
674 VclPtr<FormattedField> m_xButton;
676 protected:
677 Formatter& m_rFormatter;
679 private:
680 DECL_LINK(UpDownHdl, SpinField&, void);
681 DECL_LINK(LoseFocusHdl, Control&, void);
682 DECL_LINK(OutputHdl, LinkParamNone*, bool);
683 DECL_LINK(InputHdl, sal_Int64*, TriState);
684 DECL_LINK(ActivateHdl, Edit&, bool);
686 double toField(sal_Int64 nValue) const;
688 sal_Int64 fromField(double fValue) const;
690 public:
691 SalInstanceSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder,
692 bool bTakeOwnership);
694 virtual sal_Int64 get_value() const override;
696 virtual void set_value(sal_Int64 value) override;
698 virtual void set_range(sal_Int64 min, sal_Int64 max) override;
700 virtual void get_range(sal_Int64& min, sal_Int64& max) const override;
702 virtual void set_increments(int step, int /*page*/) override;
704 virtual void get_increments(int& step, int& page) const override;
706 virtual void set_digits(unsigned int digits) override;
708 // SpinButton may be comprised of multiple subwidgets, consider the lot as
709 // one thing for focus
710 virtual bool has_focus() const override;
712 //off by default for direct SpinButtons, MetricSpinButton enables it
713 void SetUseThousandSep();
715 virtual unsigned int get_digits() const override;
717 virtual ~SalInstanceSpinButton() override;
720 //ComboBox and ListBox have similar apis, ComboBoxes in LibreOffice have an edit box and ListBoxes
721 //don't. This distinction isn't there in Gtk. Use a template to sort this problem out.
722 template <class vcl_type>
723 class SalInstanceComboBox : public SalInstanceWidget, public virtual weld::ComboBox
725 protected:
726 // owner for ListBox/ComboBox UserData
727 std::vector<std::shared_ptr<OUString>> m_aUserData;
728 VclPtr<vcl_type> m_xComboBox;
729 ScopedVclPtr<MenuButton> m_xMenuButton;
730 OUString m_sMenuButtonRow;
732 public:
733 SalInstanceComboBox(vcl_type* pComboBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
734 : SalInstanceWidget(pComboBox, pBuilder, bTakeOwnership)
735 , m_xComboBox(pComboBox)
739 virtual int get_active() const override
741 const sal_Int32 nRet = m_xComboBox->GetSelectedEntryPos();
742 if (nRet == LISTBOX_ENTRY_NOTFOUND)
743 return -1;
744 return nRet;
747 const OUString* getEntryData(int index) const
749 return static_cast<const OUString*>(m_xComboBox->GetEntryData(index));
752 // ComboBoxes are comprised of multiple subwidgets, consider the lot as
753 // one thing for focus
754 virtual bool has_focus() const override
756 return m_xWidget->HasChildPathFocus()
757 || (m_xMenuButton && (m_xMenuButton->HasFocus() || m_xMenuButton->InPopupMode()));
760 virtual OUString get_active_id() const override
762 sal_Int32 nPos = m_xComboBox->GetSelectedEntryPos();
763 const OUString* pRet;
764 if (nPos != LISTBOX_ENTRY_NOTFOUND)
765 pRet = getEntryData(m_xComboBox->GetSelectedEntryPos());
766 else
767 pRet = nullptr;
768 if (!pRet)
769 return OUString();
770 return *pRet;
773 virtual void set_active_id(const OUString& rStr) override
775 for (int i = 0; i < get_count(); ++i)
777 const OUString* pId = getEntryData(i);
778 if (!pId)
779 continue;
780 if (*pId == rStr)
781 m_xComboBox->SelectEntryPos(i);
785 virtual void set_active(int pos) override
787 if (pos == -1)
789 m_xComboBox->SetNoSelection();
790 return;
792 m_xComboBox->SelectEntryPos(pos);
795 virtual OUString get_text(int pos) const override { return m_xComboBox->GetEntry(pos); }
797 virtual OUString get_id(int pos) const override
799 const OUString* pRet = getEntryData(pos);
800 if (!pRet)
801 return OUString();
802 return *pRet;
805 virtual void set_id(int row, const OUString& rId) override
807 m_aUserData.emplace_back(std::make_unique<OUString>(rId));
808 m_xComboBox->SetEntryData(row, m_aUserData.back().get());
811 virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems,
812 bool bKeepExisting) override
814 freeze();
815 if (!bKeepExisting)
816 clear();
817 for (const auto& rItem : rItems)
819 insert(-1, rItem.sString, rItem.sId.isEmpty() ? nullptr : &rItem.sId,
820 rItem.sImage.isEmpty() ? nullptr : &rItem.sImage, nullptr);
822 thaw();
825 virtual int get_count() const override { return m_xComboBox->GetEntryCount(); }
827 virtual int find_text(const OUString& rStr) const override
829 const sal_Int32 nRet = m_xComboBox->GetEntryPos(rStr);
830 if (nRet == LISTBOX_ENTRY_NOTFOUND)
831 return -1;
832 return nRet;
835 virtual int find_id(const OUString& rStr) const override
837 for (int i = 0; i < get_count(); ++i)
839 const OUString* pId = getEntryData(i);
840 if (!pId)
841 continue;
842 if (*pId == rStr)
843 return i;
845 return -1;
848 virtual void clear() override
850 m_xComboBox->Clear();
851 m_aUserData.clear();
854 virtual void make_sorted() override
856 m_xComboBox->SetStyle(m_xComboBox->GetStyle() | WB_SORT);
859 virtual bool get_popup_shown() const override { return m_xComboBox->IsInDropDown(); }
861 virtual void connect_popup_toggled(const Link<ComboBox&, void>& rLink) override
863 weld::ComboBox::connect_popup_toggled(rLink);
864 ensure_event_listener();
867 void call_signal_custom_render(UserDrawEvent* pEvent)
869 vcl::RenderContext* pRenderContext = pEvent->GetRenderContext();
870 auto nPos = pEvent->GetItemId();
871 const tools::Rectangle& rRect = pEvent->GetRect();
872 const OUString sId = get_id(nPos);
873 signal_custom_render(*pRenderContext, rRect, pEvent->IsSelected(), sId);
874 m_xComboBox->DrawEntry(*pEvent); // draw separator
876 if (m_xMenuButton && m_xMenuButton->IsVisible() && m_sMenuButtonRow == sId)
878 vcl::Window* pEventWindow = m_xComboBox->GetMainWindow();
879 if (m_xMenuButton->GetParent() != pEventWindow)
880 m_xMenuButton->SetParent(pEventWindow);
881 int nButtonWidth = get_menu_button_width();
882 m_xMenuButton->SetSizePixel(Size(nButtonWidth, rRect.GetHeight()));
883 m_xMenuButton->SetPosPixel(Point(rRect.GetWidth() - nButtonWidth, rRect.Top()));
887 VclPtr<VirtualDevice> create_render_virtual_device() const override
889 auto xRet = VclPtr<VirtualDevice>::Create();
890 xRet->SetBackground(Application::GetSettings().GetStyleSettings().GetFieldColor());
891 return xRet;
894 virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) override
896 SalInstanceMenu* pInstanceMenu = dynamic_cast<SalInstanceMenu*>(pMenu);
898 PopupMenu* pPopup = pInstanceMenu ? pInstanceMenu->getMenu() : nullptr;
900 if (!m_xMenuButton)
901 m_xMenuButton
902 = VclPtr<MenuButton>::Create(m_xComboBox, WB_FLATBUTTON | WB_NOPOINTERFOCUS);
904 m_xMenuButton->SetPopupMenu(pPopup);
905 m_xMenuButton->Show(pPopup != nullptr);
906 m_sMenuButtonRow = OUString::fromUtf8(rIdent);
909 int get_menu_button_width() const override
911 OutputDevice* pDefault = Application::GetDefaultDevice();
912 return 20 * (pDefault ? pDefault->GetDPIScaleFactor() : 1.0);
915 void CallHandleEventListener(VclWindowEvent& rEvent)
917 if (rEvent.GetId() == VclEventId::DropdownPreOpen
918 || rEvent.GetId() == VclEventId::DropdownClose)
920 signal_popup_toggled();
921 return;
923 SalInstanceWidget::HandleEventListener(rEvent);
927 class SalInstanceComboBoxWithoutEdit : public SalInstanceComboBox<ListBox>
929 private:
930 DECL_LINK(SelectHdl, ListBox&, void);
932 public:
933 SalInstanceComboBoxWithoutEdit(ListBox* pListBox, SalInstanceBuilder* pBuilder,
934 bool bTakeOwnership);
936 virtual OUString get_active_text() const override;
938 virtual void remove(int pos) override;
940 virtual void insert(int pos, const OUString& rStr, const OUString* pId,
941 const OUString* pIconName, VirtualDevice* pImageSurface) override;
943 virtual void insert_separator(int pos, const OUString& /*rId*/) override;
945 virtual bool has_entry() const override;
947 virtual bool changed_by_direct_pick() const override;
949 virtual void set_entry_message_type(weld::EntryMessageType /*eType*/) override;
951 virtual void set_entry_text(const OUString& /*rText*/) override;
953 virtual void select_entry_region(int /*nStartPos*/, int /*nEndPos*/) override;
955 virtual bool get_entry_selection_bounds(int& /*rStartPos*/, int& /*rEndPos*/) override;
957 virtual void set_entry_width_chars(int /*nChars*/) override;
959 virtual void set_entry_max_length(int /*nChars*/) override;
961 virtual void set_entry_completion(bool, bool bCaseSensitive = false) override;
963 virtual void set_entry_placeholder_text(const OUString&) override;
965 virtual void set_entry_editable(bool bEditable) override;
967 virtual void cut_entry_clipboard() override;
969 virtual void copy_entry_clipboard() override;
971 virtual void paste_entry_clipboard() override;
973 virtual void set_font(const vcl::Font& rFont) override;
975 virtual void set_entry_font(const vcl::Font&) override;
977 virtual vcl::Font get_entry_font() override;
979 virtual void set_custom_renderer(bool bOn) override;
981 virtual int get_max_mru_count() const override;
983 virtual void set_max_mru_count(int) override;
985 virtual OUString get_mru_entries() const override;
987 virtual void set_mru_entries(const OUString&) override;
989 virtual void HandleEventListener(VclWindowEvent& rEvent) override;
991 virtual ~SalInstanceComboBoxWithoutEdit() override;
994 class SalInstanceComboBoxWithEdit : public SalInstanceComboBox<ComboBox>
996 private:
997 DECL_LINK(ChangeHdl, Edit&, void);
998 DECL_LINK(EntryActivateHdl, Edit&, bool);
999 DECL_LINK(SelectHdl, ::ComboBox&, void);
1000 DECL_LINK(UserDrawHdl, UserDrawEvent*, void);
1001 WeldTextFilter m_aTextFilter;
1002 bool m_bInSelect;
1004 public:
1005 SalInstanceComboBoxWithEdit(::ComboBox* pComboBox, SalInstanceBuilder* pBuilder,
1006 bool bTakeOwnership);
1008 virtual bool has_entry() const override;
1010 virtual bool changed_by_direct_pick() const override;
1012 virtual void set_entry_message_type(weld::EntryMessageType eType) override;
1014 virtual OUString get_active_text() const override;
1016 virtual void remove(int pos) override;
1018 virtual void insert(int pos, const OUString& rStr, const OUString* pId,
1019 const OUString* pIconName, VirtualDevice* pImageSurface) override;
1021 virtual void insert_separator(int pos, const OUString& /*rId*/) override;
1023 virtual void set_entry_text(const OUString& rText) override;
1025 virtual void set_entry_width_chars(int nChars) override;
1027 virtual void set_entry_max_length(int nChars) override;
1029 virtual void set_entry_completion(bool bEnable, bool bCaseSensitive = false) override;
1031 virtual void set_entry_placeholder_text(const OUString& rText) override;
1033 virtual void set_entry_editable(bool bEditable) override;
1035 virtual void cut_entry_clipboard() override;
1037 virtual void copy_entry_clipboard() override;
1039 virtual void paste_entry_clipboard() override;
1041 virtual void select_entry_region(int nStartPos, int nEndPos) override;
1043 virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) override;
1045 virtual void set_font(const vcl::Font& rFont) override;
1047 virtual void set_entry_font(const vcl::Font& rFont) override;
1049 virtual vcl::Font get_entry_font() override;
1051 virtual void set_custom_renderer(bool bOn) override;
1053 virtual int get_max_mru_count() const override;
1055 virtual void set_max_mru_count(int nCount) override;
1057 virtual OUString get_mru_entries() const override;
1059 virtual void set_mru_entries(const OUString& rEntries) override;
1061 virtual void HandleEventListener(VclWindowEvent& rEvent) override;
1063 virtual void call_attention_to() override;
1065 virtual ~SalInstanceComboBoxWithEdit() override;
1068 class SalInstanceButton : public SalInstanceWidget, public virtual weld::Button
1070 private:
1071 VclPtr<::Button> m_xButton;
1072 Link<::Button*, void> const m_aOldClickHdl;
1074 DECL_LINK(ClickHdl, ::Button*, void);
1076 protected:
1077 void set_label_wrap(bool bWrap);
1079 public:
1080 SalInstanceButton(::Button* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1082 virtual void set_label(const OUString& rText) override;
1084 virtual void set_image(VirtualDevice* pDevice) override;
1086 virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override;
1088 virtual void set_from_icon_name(const OUString& rIconName) override;
1090 virtual OUString get_label() const override;
1092 virtual void set_font(const vcl::Font& rFont) override;
1094 virtual void set_custom_button(VirtualDevice* pDevice) override;
1096 virtual ~SalInstanceButton() override;
1099 class SalInstanceToggleButton : public SalInstanceButton, public virtual weld::ToggleButton
1101 private:
1102 VclPtr<PushButton> m_xToggleButton;
1104 DECL_LINK(ToggleListener, VclWindowEvent&, void);
1106 public:
1107 SalInstanceToggleButton(PushButton* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
1108 : SalInstanceButton(pButton, pBuilder, bTakeOwnership)
1109 , m_xToggleButton(pButton)
1111 m_xToggleButton->setToggleButton(true);
1114 virtual void connect_toggled(const Link<Toggleable&, void>& rLink) override
1116 assert(!m_aToggleHdl.IsSet());
1117 m_xToggleButton->AddEventListener(LINK(this, SalInstanceToggleButton, ToggleListener));
1118 weld::ToggleButton::connect_toggled(rLink);
1121 virtual void set_active(bool active) override
1123 disable_notify_events();
1124 m_xToggleButton->Check(active);
1125 enable_notify_events();
1128 virtual bool get_active() const override { return m_xToggleButton->IsChecked(); }
1130 virtual void set_inconsistent(bool inconsistent) override
1132 disable_notify_events();
1133 m_xToggleButton->SetState(inconsistent ? TRISTATE_INDET : TRISTATE_FALSE);
1134 enable_notify_events();
1137 virtual bool get_inconsistent() const override
1139 return m_xToggleButton->GetState() == TRISTATE_INDET;
1142 virtual ~SalInstanceToggleButton() override
1144 if (m_aToggleHdl.IsSet())
1145 m_xToggleButton->RemoveEventListener(
1146 LINK(this, SalInstanceToggleButton, ToggleListener));
1150 class SalInstanceNotebook : public SalInstanceWidget, public virtual weld::Notebook
1152 private:
1153 VclPtr<TabControl> m_xNotebook;
1154 mutable std::vector<std::shared_ptr<SalInstanceContainer>> m_aPages;
1155 std::map<OString, std::pair<VclPtr<TabPage>, VclPtr<VclGrid>>> m_aAddedPages;
1157 DECL_LINK(DeactivatePageHdl, TabControl*, bool);
1158 DECL_LINK(ActivatePageHdl, TabControl*, void);
1160 public:
1161 SalInstanceNotebook(TabControl* pNotebook, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1163 virtual int get_current_page() const override;
1165 virtual int get_page_index(const OString& rIdent) const override;
1167 virtual OString get_page_ident(int nPage) const override;
1169 virtual OString get_current_page_ident() const override;
1171 virtual weld::Container* get_page(const OString& rIdent) const override;
1173 virtual void set_current_page(int nPage) override;
1175 virtual void set_current_page(const OString& rIdent) override;
1177 virtual void remove_page(const OString& rIdent) override;
1179 virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override;
1181 virtual int get_n_pages() const override;
1183 virtual OUString get_tab_label_text(const OString& rIdent) const override;
1185 virtual void set_tab_label_text(const OString& rIdent, const OUString& rText) override;
1187 virtual void set_show_tabs(bool bShow) override;
1189 virtual ~SalInstanceNotebook() override;
1192 class SalInstanceMessageDialog : public SalInstanceDialog, public virtual weld::MessageDialog
1194 protected:
1195 VclPtr<::MessageDialog> m_xMessageDialog;
1197 public:
1198 SalInstanceMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder,
1199 bool bTakeOwnership);
1201 virtual void set_primary_text(const OUString& rText) override;
1203 virtual OUString get_primary_text() const override;
1205 virtual void set_secondary_text(const OUString& rText) override;
1207 virtual OUString get_secondary_text() const override;
1209 virtual weld::Container* weld_message_area() override;
1212 class SalInstanceLinkButton : public SalInstanceWidget, public virtual weld::LinkButton
1214 private:
1215 VclPtr<FixedHyperlink> m_xButton;
1216 Link<FixedHyperlink&, void> m_aOrigClickHdl;
1218 DECL_LINK(ClickHdl, FixedHyperlink&, void);
1220 public:
1221 SalInstanceLinkButton(FixedHyperlink* pButton, SalInstanceBuilder* pBuilder,
1222 bool bTakeOwnership)
1223 : SalInstanceWidget(pButton, pBuilder, bTakeOwnership)
1224 , m_xButton(pButton)
1226 m_aOrigClickHdl = m_xButton->GetClickHdl();
1227 m_xButton->SetClickHdl(LINK(this, SalInstanceLinkButton, ClickHdl));
1230 virtual void set_label(const OUString& rText) override { m_xButton->SetText(rText); }
1232 virtual OUString get_label() const override { return m_xButton->GetText(); }
1234 virtual void set_uri(const OUString& rUri) override { m_xButton->SetURL(rUri); }
1236 virtual OUString get_uri() const override { return m_xButton->GetURL(); }
1238 virtual ~SalInstanceLinkButton() override { m_xButton->SetClickHdl(m_aOrigClickHdl); }
1241 class SalInstanceCheckButton : public SalInstanceButton, public virtual weld::CheckButton
1243 private:
1244 VclPtr<CheckBox> m_xCheckButton;
1246 DECL_LINK(ToggleHdl, CheckBox&, void);
1248 public:
1249 SalInstanceCheckButton(CheckBox* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1251 virtual void set_active(bool active) override;
1253 virtual bool get_active() const override;
1255 virtual void set_inconsistent(bool inconsistent) override;
1257 virtual bool get_inconsistent() const override;
1259 virtual void set_label(const OUString& rText) override { SalInstanceButton::set_label(rText); }
1261 virtual OUString get_label() const override { return SalInstanceButton::get_label(); }
1263 virtual void set_label_wrap(bool wrap) override { SalInstanceButton::set_label_wrap(wrap); }
1265 virtual ~SalInstanceCheckButton() override;
1268 class SalInstanceDrawingArea : public SalInstanceWidget, public virtual weld::DrawingArea
1270 private:
1271 VclPtr<VclDrawingArea> m_xDrawingArea;
1273 typedef std::pair<vcl::RenderContext&, const tools::Rectangle&> target_and_area;
1274 DECL_LINK(PaintHdl, target_and_area, void);
1275 DECL_LINK(ResizeHdl, const Size&, void);
1276 DECL_LINK(MousePressHdl, const MouseEvent&, bool);
1277 DECL_LINK(MouseMoveHdl, const MouseEvent&, bool);
1278 DECL_LINK(MouseReleaseHdl, const MouseEvent&, bool);
1279 DECL_LINK(KeyPressHdl, const KeyEvent&, bool);
1280 DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool);
1281 DECL_LINK(StyleUpdatedHdl, VclDrawingArea&, void);
1282 DECL_LINK(CommandHdl, const CommandEvent&, bool);
1283 DECL_LINK(QueryTooltipHdl, tools::Rectangle&, OUString);
1284 DECL_LINK(GetSurroundingHdl, OUString&, int);
1285 DECL_LINK(DeleteSurroundingHdl, const Selection&, bool);
1286 DECL_LINK(StartDragHdl, VclDrawingArea*, bool);
1288 // SalInstanceWidget has a generic listener for all these
1289 // events, ignore the ones we have specializations for
1290 // in VclDrawingArea
1291 virtual void HandleEventListener(VclWindowEvent& rEvent) override;
1293 virtual void HandleMouseEventListener(VclWindowEvent& rEvent) override;
1295 virtual bool HandleKeyEventListener(VclWindowEvent& /*rEvent*/) override;
1297 public:
1298 SalInstanceDrawingArea(VclDrawingArea* pDrawingArea, SalInstanceBuilder* pBuilder,
1299 const a11yref& rAlly, FactoryFunction pUITestFactoryFunction,
1300 void* pUserData, bool bTakeOwnership);
1302 virtual void queue_draw() override;
1304 virtual void queue_draw_area(int x, int y, int width, int height) override;
1306 virtual void connect_size_allocate(const Link<const Size&, void>& rLink) override;
1308 virtual void connect_key_press(const Link<const KeyEvent&, bool>& rLink) override;
1310 virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink) override;
1312 virtual void set_cursor(PointerStyle ePointerStyle) override;
1314 virtual Point get_pointer_position() const override;
1316 virtual void set_input_context(const InputContext& rInputContext) override;
1318 virtual void im_context_set_cursor_location(const tools::Rectangle& rCursorRect,
1319 int nExtTextInputWidth) override;
1321 virtual a11yref get_accessible_parent() override;
1323 virtual a11yrelationset get_accessible_relation_set() override;
1325 virtual Point get_accessible_location_on_screen() override;
1327 virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rHelper,
1328 sal_uInt8 eDNDConstants) override;
1330 virtual ~SalInstanceDrawingArea() override;
1332 virtual OutputDevice& get_ref_device() override;
1334 virtual void click(const Point& rPos) override;
1336 virtual void dblclick(const Point& rPos) override;
1338 virtual void mouse_up(const Point& rPos) override;
1340 virtual void mouse_down(const Point& rPos) override;
1342 virtual void mouse_move(const Point& rPos) override;
1345 class SalInstanceToolbar : public SalInstanceWidget, public virtual weld::Toolbar
1347 protected:
1348 VclPtr<ToolBox> m_xToolBox;
1349 std::map<ToolBoxItemId, VclPtr<vcl::Window>> m_aFloats;
1350 std::map<ToolBoxItemId, VclPtr<PopupMenu>> m_aMenus;
1352 OString m_sStartShowIdent;
1354 DECL_LINK(ClickHdl, ToolBox*, void);
1355 DECL_LINK(DropdownClick, ToolBox*, void);
1356 DECL_LINK(MenuToggleListener, VclWindowEvent&, void);
1358 public:
1359 SalInstanceToolbar(ToolBox* pToolBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1361 virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override;
1363 virtual bool get_item_sensitive(const OString& rIdent) const override;
1365 virtual void set_item_visible(const OString& rIdent, bool bVisible) override;
1367 virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) override;
1369 virtual bool get_item_visible(const OString& rIdent) const override;
1371 virtual void set_item_active(const OString& rIdent, bool bActive) override;
1373 virtual bool get_item_active(const OString& rIdent) const override;
1375 void set_menu_item_active(const OString& rIdent, bool bActive) override;
1377 bool get_menu_item_active(const OString& rIdent) const override;
1379 virtual void set_item_popover(const OString& rIdent, weld::Widget* pPopover) override;
1381 virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) override;
1383 virtual void insert_item(int pos, const OUString& rId) override;
1385 virtual void insert_separator(int pos, const OUString& /*rId*/) override;
1387 virtual int get_n_items() const override;
1389 virtual OString get_item_ident(int nIndex) const override;
1391 virtual void set_item_ident(int nIndex, const OString& rIdent) override;
1393 virtual void set_item_label(int nIndex, const OUString& rLabel) override;
1395 virtual OUString get_item_label(const OString& rIdent) const override;
1397 virtual void set_item_label(const OString& rIdent, const OUString& rLabel) override;
1399 virtual void set_item_icon_name(const OString& rIdent, const OUString& rIconName) override;
1401 virtual void set_item_image_mirrored(const OString& rIdent, bool bMirrored) override;
1403 virtual void set_item_image(const OString& rIdent,
1404 const css::uno::Reference<css::graphic::XGraphic>& rIcon) override;
1406 virtual void set_item_image(const OString& rIdent, VirtualDevice* pDevice) override;
1408 virtual void set_item_image(int nIndex,
1409 const css::uno::Reference<css::graphic::XGraphic>& rIcon) override;
1411 virtual void set_item_tooltip_text(int nIndex, const OUString& rTip) override;
1413 virtual void set_item_tooltip_text(const OString& rIdent, const OUString& rTip) override;
1415 virtual OUString get_item_tooltip_text(const OString& rIdent) const override;
1417 virtual vcl::ImageType get_icon_size() const override;
1419 virtual void set_icon_size(vcl::ImageType eType) override;
1421 virtual sal_uInt16 get_modifier_state() const override;
1423 virtual int get_drop_index(const Point& rPoint) const override;
1425 virtual ~SalInstanceToolbar() override;
1428 class SalInstanceTextView : public SalInstanceWidget, public virtual weld::TextView
1430 private:
1431 VclPtr<VclMultiLineEdit> m_xTextView;
1432 Link<ScrollBar*, void> m_aOrigVScrollHdl;
1434 DECL_LINK(ChangeHdl, Edit&, void);
1435 DECL_LINK(VscrollHdl, ScrollBar*, void);
1436 DECL_LINK(CursorListener, VclWindowEvent&, void);
1438 public:
1439 SalInstanceTextView(VclMultiLineEdit* pTextView, SalInstanceBuilder* pBuilder,
1440 bool bTakeOwnership);
1442 virtual void set_text(const OUString& rText) override;
1444 virtual void replace_selection(const OUString& rText) override;
1446 virtual OUString get_text() const override;
1448 bool get_selection_bounds(int& rStartPos, int& rEndPos) override;
1450 virtual void select_region(int nStartPos, int nEndPos) override;
1452 virtual void set_editable(bool bEditable) override;
1453 virtual bool get_editable() const override;
1454 virtual void set_max_length(int nChars) override;
1456 virtual void set_monospace(bool bMonospace) override;
1458 virtual void set_font(const vcl::Font& rFont) override;
1460 virtual void set_font_color(const Color& rColor) override;
1462 virtual void connect_cursor_position(const Link<TextView&, void>& rLink) override;
1464 virtual bool can_move_cursor_with_up() const override;
1466 virtual bool can_move_cursor_with_down() const override;
1468 virtual void cut_clipboard() override;
1470 virtual void copy_clipboard() override;
1472 virtual void paste_clipboard() override;
1474 virtual void set_alignment(TxtAlign eXAlign) override;
1476 virtual int vadjustment_get_value() const override;
1478 virtual void vadjustment_set_value(int value) override;
1480 virtual int vadjustment_get_upper() const override;
1482 virtual int vadjustment_get_lower() const override;
1484 virtual int vadjustment_get_page_size() const override;
1486 virtual bool has_focus() const override;
1488 virtual ~SalInstanceTextView() override;
1491 struct SalInstanceTreeIter final : public weld::TreeIter
1493 SalInstanceTreeIter(const SalInstanceTreeIter* pOrig)
1494 : iter(pOrig ? pOrig->iter : nullptr)
1497 SalInstanceTreeIter(SvTreeListEntry* pIter)
1498 : iter(pIter)
1501 virtual bool equal(const TreeIter& rOther) const override
1503 return iter == static_cast<const SalInstanceTreeIter&>(rOther).iter;
1505 SvTreeListEntry* iter;
1508 class SalInstanceTreeView : public SalInstanceWidget, public virtual weld::TreeView
1510 protected:
1511 // owner for UserData
1512 std::vector<std::unique_ptr<OUString>> m_aUserData;
1513 VclPtr<SvTabListBox> m_xTreeView;
1514 SvLBoxButtonData m_aCheckButtonData;
1515 SvLBoxButtonData m_aRadioButtonData;
1516 // currently expanding parent that logically, but not currently physically,
1517 // contain placeholders
1518 o3tl::sorted_vector<SvTreeListEntry*> m_aExpandingPlaceHolderParents;
1519 // which columns should be custom rendered
1520 o3tl::sorted_vector<int> m_aCustomRenders;
1521 bool m_bTogglesAsRadio;
1522 int m_nSortColumn;
1524 DECL_LINK(SelectHdl, SvTreeListBox*, void);
1525 DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
1526 DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
1527 DECL_LINK(ExpandingHdl, SvTreeListBox*, bool);
1528 DECL_LINK(EndDragHdl, HeaderBar*, void);
1529 DECL_LINK(HeaderBarClickedHdl, HeaderBar*, void);
1530 DECL_LINK(ToggleHdl, SvLBoxButtonData*, void);
1531 DECL_LINK(ModelChangedHdl, SvTreeListBox*, void);
1532 DECL_LINK(StartDragHdl, SvTreeListBox*, bool);
1533 DECL_STATIC_LINK(SalInstanceTreeView, FinishDragHdl, SvTreeListBox*, void);
1534 DECL_LINK(EditingEntryHdl, SvTreeListEntry*, bool);
1535 typedef std::pair<SvTreeListEntry*, OUString> IterString;
1536 DECL_LINK(EditedEntryHdl, IterString, bool);
1537 DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void);
1538 DECL_LINK(CompareHdl, const SvSortData&, sal_Int32);
1539 DECL_LINK(PopupMenuHdl, const CommandEvent&, bool);
1540 DECL_LINK(TooltipHdl, SvTreeListEntry*, OUString);
1541 DECL_LINK(CustomRenderHdl, svtree_render_args, void);
1542 DECL_LINK(CustomMeasureHdl, svtree_measure_args, Size);
1544 bool ExpandRow(const SalInstanceTreeIter& rIter);
1546 // Each row has a cell for the expander image, (and an optional cell for a
1547 // checkbutton if enable_toggle_buttons has been called) which precede
1548 // index 0
1549 int to_internal_model(int col) const;
1551 int to_external_model(int col) const;
1553 bool IsDummyEntry(SvTreeListEntry* pEntry) const;
1555 SvTreeListEntry* GetPlaceHolderChild(SvTreeListEntry* pEntry) const;
1557 static void set_font_color(SvTreeListEntry* pEntry, const Color& rColor);
1559 void AddStringItem(SvTreeListEntry* pEntry, const OUString& rStr, int nCol);
1561 void do_insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
1562 const OUString* pId, const OUString* pIconName,
1563 const VirtualDevice* pImageSurface, bool bChildrenOnDemand, weld::TreeIter* pRet,
1564 bool bIsSeparator);
1566 void update_checkbutton_column_width(SvTreeListEntry* pEntry);
1568 void InvalidateModelEntry(SvTreeListEntry* pEntry);
1570 void do_set_toggle(SvTreeListEntry* pEntry, TriState eState, int col);
1572 static TriState do_get_toggle(SvTreeListEntry* pEntry, int col);
1573 static bool do_get_sensitive(SvTreeListEntry* pEntry, int col);
1575 TriState get_toggle(SvTreeListEntry* pEntry, int col) const;
1577 void set_toggle(SvTreeListEntry* pEntry, TriState eState, int col);
1579 bool get_text_emphasis(SvTreeListEntry* pEntry, int col) const;
1581 void set_header_item_width(const std::vector<int>& rWidths);
1583 public:
1584 SalInstanceTreeView(SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1586 virtual void connect_query_tooltip(const Link<const weld::TreeIter&, OUString>& rLink) override;
1588 virtual void columns_autosize() override;
1590 virtual void freeze() override;
1592 virtual void thaw() override;
1594 virtual void set_column_fixed_widths(const std::vector<int>& rWidths) override;
1596 virtual void set_column_editables(const std::vector<bool>& rEditables) override;
1598 virtual void set_centered_column(int nCol) override;
1600 virtual int get_column_width(int nColumn) const override;
1602 virtual OUString get_column_title(int nColumn) const override;
1604 virtual void set_column_title(int nColumn, const OUString& rTitle) override;
1606 virtual void set_column_custom_renderer(int nColumn, bool bEnable) override;
1608 virtual void queue_draw() override;
1610 virtual void show() override;
1612 virtual void hide() override;
1614 virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
1615 const OUString* pId, const OUString* pIconName,
1616 VirtualDevice* pImageSurface, bool bChildrenOnDemand,
1617 weld::TreeIter* pRet) override;
1619 virtual void insert_separator(int pos, const OUString& /*rId*/) override;
1621 virtual void
1622 bulk_insert_for_each(int nSourceCount,
1623 const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
1624 const weld::TreeIter* pParent = nullptr,
1625 const std::vector<int>* pFixedWidths = nullptr) override;
1627 virtual void set_font_color(int pos, const Color& rColor) override;
1629 virtual void set_font_color(const weld::TreeIter& rIter, const Color& rColor) override;
1631 virtual void remove(int pos) override;
1633 virtual int find_text(const OUString& rText) const override;
1635 virtual int find_id(const OUString& rId) const override;
1637 virtual void swap(int pos1, int pos2) override;
1639 virtual void clear() override;
1641 virtual int n_children() const override;
1643 virtual int iter_n_children(const weld::TreeIter& rIter) const override;
1645 virtual void select(int pos) override;
1647 virtual int get_cursor_index() const override;
1649 virtual void set_cursor(int pos) override;
1651 virtual void scroll_to_row(int pos) override;
1653 virtual bool is_selected(int pos) const override;
1655 virtual void unselect(int pos) override;
1657 virtual std::vector<int> get_selected_rows() const override;
1659 OUString get_text(SvTreeListEntry* pEntry, int col) const;
1661 virtual OUString get_text(int pos, int col = -1) const override;
1663 void set_text(SvTreeListEntry* pEntry, const OUString& rText, int col);
1665 virtual void set_text(int pos, const OUString& rText, int col = -1) override;
1667 using SalInstanceWidget::set_sensitive;
1668 using SalInstanceWidget::get_sensitive;
1670 void set_sensitive(SvTreeListEntry* pEntry, bool bSensitive, int col);
1671 bool get_sensitive(SvTreeListEntry* pEntry, int col) const;
1673 virtual void set_sensitive(int pos, bool bSensitive, int col = -1) override;
1675 virtual void set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col = -1) override;
1677 virtual bool get_sensitive(int pos, int col) const override;
1679 virtual bool get_sensitive(const weld::TreeIter& rIter, int col) const override;
1681 virtual TriState get_toggle(int pos, int col = -1) const override;
1683 virtual TriState get_toggle(const weld::TreeIter& rIter, int col = -1) const override;
1685 virtual void enable_toggle_buttons(weld::ColumnToggleType eType) override;
1687 virtual void set_toggle(int pos, TriState eState, int col = -1) override;
1689 virtual void set_toggle(const weld::TreeIter& rIter, TriState eState, int col = -1) override;
1691 virtual void set_clicks_to_toggle(int nToggleBehavior) override;
1693 virtual void set_extra_row_indent(const weld::TreeIter& rIter, int nIndentLevel) override;
1695 void set_text_emphasis(SvTreeListEntry* pEntry, bool bOn, int col = -1);
1697 virtual void set_text_emphasis(const weld::TreeIter& rIter, bool bOn, int col) override;
1699 virtual void set_text_emphasis(int pos, bool bOn, int col) override;
1701 virtual bool get_text_emphasis(const weld::TreeIter& rIter, int col) const override;
1703 virtual bool get_text_emphasis(int pos, int col) const override;
1705 void set_text_align(SvTreeListEntry* pEntry, double fAlign, int col);
1707 virtual void set_text_align(const weld::TreeIter& rIter, double fAlign, int col) override;
1709 virtual void set_text_align(int pos, double fAlign, int col) override;
1711 virtual void connect_editing(const Link<const weld::TreeIter&, bool>& rStartLink,
1712 const Link<const iter_string&, bool>& rEndLink) override;
1714 virtual void start_editing(const weld::TreeIter& rIter) override;
1716 virtual void end_editing() override;
1718 void set_image(SvTreeListEntry* pEntry, const Image& rImage, int col);
1720 virtual void set_image(int pos, const OUString& rImage, int col = -1) override;
1722 virtual void set_image(int pos, const css::uno::Reference<css::graphic::XGraphic>& rImage,
1723 int col = -1) override;
1725 virtual void set_image(int pos, VirtualDevice& rImage, int col = -1) override;
1727 virtual void set_image(const weld::TreeIter& rIter, const OUString& rImage,
1728 int col = -1) override;
1730 virtual void set_image(const weld::TreeIter& rIter,
1731 const css::uno::Reference<css::graphic::XGraphic>& rImage,
1732 int col = -1) override;
1734 virtual void set_image(const weld::TreeIter& rIter, VirtualDevice& rImage,
1735 int col = -1) override;
1737 const OUString* getEntryData(int index) const;
1739 virtual OUString get_id(int pos) const override;
1741 void set_id(SvTreeListEntry* pEntry, const OUString& rId);
1743 virtual void set_id(int pos, const OUString& rId) override;
1745 virtual int get_selected_index() const override;
1747 virtual OUString get_selected_text() const override;
1749 virtual OUString get_selected_id() const override;
1751 virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig
1752 = nullptr) const override;
1754 virtual void copy_iterator(const weld::TreeIter& rSource, weld::TreeIter& rDest) const override;
1756 virtual bool get_selected(weld::TreeIter* pIter) const override;
1758 virtual bool get_cursor(weld::TreeIter* pIter) const override;
1760 virtual void set_cursor(const weld::TreeIter& rIter) override;
1762 virtual bool get_iter_first(weld::TreeIter& rIter) const override;
1764 virtual bool get_iter_abs_pos(weld::TreeIter& rIter, int nPos) const;
1766 virtual bool iter_next_sibling(weld::TreeIter& rIter) const override;
1768 virtual bool iter_previous_sibling(weld::TreeIter& rIter) const override;
1770 virtual bool iter_next(weld::TreeIter& rIter) const override;
1772 virtual bool iter_previous(weld::TreeIter& rIter) const override;
1774 virtual bool iter_children(weld::TreeIter& rIter) const override;
1776 virtual bool iter_parent(weld::TreeIter& rIter) const override;
1778 virtual void remove(const weld::TreeIter& rIter) override;
1780 virtual void select(const weld::TreeIter& rIter) override;
1782 virtual void scroll_to_row(const weld::TreeIter& rIter) override;
1784 virtual void unselect(const weld::TreeIter& rIter) override;
1786 virtual int get_iter_depth(const weld::TreeIter& rIter) const override;
1788 virtual bool iter_has_child(const weld::TreeIter& rIter) const override;
1790 virtual bool get_row_expanded(const weld::TreeIter& rIter) const override;
1792 virtual bool get_children_on_demand(const weld::TreeIter& rIter) const override;
1794 virtual void set_children_on_demand(const weld::TreeIter& rIter,
1795 bool bChildrenOnDemand) override;
1797 virtual void expand_row(const weld::TreeIter& rIter) override;
1799 virtual void collapse_row(const weld::TreeIter& rIter) override;
1801 virtual OUString get_text(const weld::TreeIter& rIter, int col = -1) const override;
1803 virtual void set_text(const weld::TreeIter& rIter, const OUString& rText,
1804 int col = -1) override;
1806 virtual OUString get_id(const weld::TreeIter& rIter) const override;
1808 virtual void set_id(const weld::TreeIter& rIter, const OUString& rId) override;
1810 virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rHelper,
1811 sal_uInt8 eDNDConstants) override;
1813 virtual void set_selection_mode(SelectionMode eMode) override;
1815 virtual void all_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
1817 virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
1819 virtual void visible_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
1821 virtual void connect_visible_range_changed(const Link<weld::TreeView&, void>& rLink) override;
1823 virtual void remove_selection() override;
1825 virtual bool is_selected(const weld::TreeIter& rIter) const override;
1827 virtual int get_iter_index_in_parent(const weld::TreeIter& rIter) const override;
1829 virtual int iter_compare(const weld::TreeIter& a, const weld::TreeIter& b) const override;
1831 virtual void move_subtree(weld::TreeIter& rNode, const weld::TreeIter* pNewParent,
1832 int nIndexInNewParent) override;
1834 virtual int count_selected_rows() const override;
1836 virtual int get_height_rows(int nRows) const override;
1838 virtual void make_sorted() override;
1840 virtual void set_sort_func(
1841 const std::function<int(const weld::TreeIter&, const weld::TreeIter&)>& func) override;
1843 virtual void make_unsorted() override;
1845 virtual void set_sort_order(bool bAscending) override;
1847 virtual bool get_sort_order() const override;
1849 virtual void set_sort_indicator(TriState eState, int col) override;
1851 virtual TriState get_sort_indicator(int col) const override;
1853 virtual int get_sort_column() const override;
1855 virtual void set_sort_column(int nColumn) override;
1857 SvTabListBox& getTreeView();
1859 virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult, bool bDnDMode,
1860 bool bAutoScroll = true) override;
1862 virtual void unset_drag_dest_row() override;
1864 virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const override;
1866 virtual TreeView* get_drag_source() const override;
1868 virtual int vadjustment_get_value() const override;
1870 virtual void vadjustment_set_value(int nValue) override;
1872 virtual void set_show_expanders(bool bShow) override;
1874 virtual bool changed_by_hover() const override;
1876 virtual ~SalInstanceTreeView() override;
1879 class SalInstanceExpander : public SalInstanceWidget, public virtual weld::Expander
1881 private:
1882 VclPtr<VclExpander> m_xExpander;
1884 DECL_LINK(ExpandedHdl, VclExpander&, void);
1886 public:
1887 SalInstanceExpander(VclExpander* pExpander, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1889 virtual void set_label(const OUString& rText) override;
1891 virtual OUString get_label() const override;
1893 virtual bool get_expanded() const override;
1895 virtual void set_expanded(bool bExpand) override;
1897 virtual bool has_focus() const override;
1899 virtual void grab_focus() override;
1901 virtual ~SalInstanceExpander() override;
1904 class SalInstanceIconView : public SalInstanceWidget, public virtual weld::IconView
1906 private:
1907 // owner for UserData
1908 std::vector<std::unique_ptr<OUString>> m_aUserData;
1909 VclPtr<::IconView> m_xIconView;
1911 DECL_LINK(SelectHdl, SvTreeListBox*, void);
1912 DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
1913 DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
1914 DECL_LINK(CommandHdl, const CommandEvent&, bool);
1915 DECL_LINK(TooltipHdl, SvTreeListEntry*, OUString);
1916 DECL_LINK(EntryAccessibleDescriptionHdl, SvTreeListEntry*, OUString);
1917 DECL_LINK(DumpElemToPropertyTreeHdl, const ::IconView::json_prop_query&, bool);
1919 public:
1920 SalInstanceIconView(::IconView* pIconView, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
1922 virtual int get_item_width() const override;
1923 virtual void set_item_width(int width) override;
1925 virtual void freeze() override;
1927 virtual void thaw() override;
1929 virtual void insert(int pos, const OUString* pStr, const OUString* pId,
1930 const OUString* pIconName, weld::TreeIter* pRet) override;
1932 virtual void insert(int pos, const OUString* pStr, const OUString* pId,
1933 const VirtualDevice* pIcon, weld::TreeIter* pRet) override;
1935 virtual void insert_separator(int pos, const OUString* pId) override;
1937 virtual void connect_query_tooltip(const Link<const weld::TreeIter&, OUString>& rLink) override;
1939 virtual void
1940 connect_get_property_tree_elem(const Link<const weld::json_prop_query&, bool>& rLink) override;
1942 virtual OUString get_selected_id() const override;
1944 virtual OUString get_selected_text() const override;
1946 virtual int count_selected_items() const override;
1948 virtual void select(int pos) override;
1950 virtual void unselect(int pos) override;
1952 virtual int n_children() const override;
1954 virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig
1955 = nullptr) const override;
1957 virtual bool get_selected(weld::TreeIter* pIter) const override;
1959 virtual bool get_cursor(weld::TreeIter* pIter) const override;
1961 virtual void set_cursor(const weld::TreeIter& rIter) override;
1963 virtual bool get_iter_first(weld::TreeIter& rIter) const override;
1965 virtual void scroll_to_item(const weld::TreeIter& rIter) override;
1967 virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
1969 virtual OUString get_id(const weld::TreeIter& rIter) const override;
1971 virtual OUString get_text(const weld::TreeIter& rIter) const override;
1973 virtual void clear() override;
1975 virtual ~SalInstanceIconView() override;
1978 class SalInstanceRadioButton : public SalInstanceButton, public virtual weld::RadioButton
1980 private:
1981 VclPtr<::RadioButton> m_xRadioButton;
1983 DECL_LINK(ToggleHdl, ::RadioButton&, void);
1985 public:
1986 SalInstanceRadioButton(::RadioButton* pButton, SalInstanceBuilder* pBuilder,
1987 bool bTakeOwnership);
1989 virtual void set_active(bool active) override;
1991 virtual bool get_active() const override;
1993 virtual void set_image(VirtualDevice* pDevice) override;
1995 virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override;
1997 virtual void set_from_icon_name(const OUString& rIconName) override;
1999 virtual void set_inconsistent(bool /*inconsistent*/) override;
2001 virtual bool get_inconsistent() const override;
2003 virtual void set_label(const OUString& rText) override { SalInstanceButton::set_label(rText); }
2005 virtual OUString get_label() const override { return SalInstanceButton::get_label(); }
2007 virtual void set_label_wrap(bool wrap) override { SalInstanceButton::set_label_wrap(wrap); }
2009 virtual ~SalInstanceRadioButton() override;
2012 class SalInstanceFrame : public SalInstanceContainer, public virtual weld::Frame
2014 private:
2015 VclPtr<VclFrame> m_xFrame;
2017 public:
2018 SalInstanceFrame(VclFrame* pFrame, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
2020 virtual void set_label(const OUString& rText) override;
2022 virtual OUString get_label() const override;
2024 virtual std::unique_ptr<weld::Label> weld_label_widget() const override;
2027 class SalInstanceMenuButton : public SalInstanceButton, public virtual weld::MenuButton
2029 protected:
2030 VclPtr<::MenuButton> m_xMenuButton;
2031 sal_uInt16 m_nLastId;
2033 DECL_LINK(MenuSelectHdl, ::MenuButton*, void);
2034 DECL_LINK(ActivateHdl, ::MenuButton*, void);
2036 public:
2037 SalInstanceMenuButton(::MenuButton* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
2039 virtual void set_active(bool active) override;
2041 virtual bool get_active() const override;
2043 virtual void set_inconsistent(bool /*inconsistent*/) override;
2045 virtual bool get_inconsistent() const override;
2047 virtual void insert_item(int pos, const OUString& rId, const OUString& rStr,
2048 const OUString* pIconName, VirtualDevice* pImageSurface,
2049 TriState eCheckRadioFalse) override;
2051 virtual void insert_separator(int pos, const OUString& rId) override;
2053 virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override;
2055 virtual void remove_item(const OString& rId) override;
2057 virtual void clear() override;
2059 virtual void set_item_active(const OString& rIdent, bool bActive) override;
2061 virtual void set_item_label(const OString& rIdent, const OUString& rText) override;
2063 virtual OUString get_item_label(const OString& rIdent) const override;
2065 virtual void set_item_visible(const OString& rIdent, bool bShow) override;
2067 virtual void set_popover(weld::Widget* pPopover) override;
2069 virtual ~SalInstanceMenuButton() override;
2072 class SalInstancePopover : public SalInstanceContainer, public virtual weld::Popover
2074 private:
2075 VclPtr<DockingWindow> m_xPopover;
2077 DECL_LINK(PopupModeEndHdl, FloatingWindow*, void);
2079 void ImplPopDown();
2081 public:
2082 SalInstancePopover(DockingWindow* pPopover, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
2084 ~SalInstancePopover();
2086 virtual void popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect,
2087 weld::Placement ePlace = weld::Placement::Under) override;
2089 virtual void popdown() override;
2091 virtual void resize_to_request() override;
2094 class SalInstanceBox : public SalInstanceContainer, public virtual weld::Box
2096 private:
2097 VclPtr<VclBox> m_xBox;
2099 public:
2100 SalInstanceBox(VclBox* pContainer, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
2101 virtual void reorder_child(weld::Widget* pWidget, int nNewPosition) override;
2102 virtual void sort_native_button_order() override;
2105 class SalInstanceImage : public SalInstanceWidget, public virtual weld::Image
2107 private:
2108 VclPtr<FixedImage> m_xImage;
2110 public:
2111 SalInstanceImage(FixedImage* pImage, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
2113 virtual void set_from_icon_name(const OUString& rIconName) override;
2115 virtual void set_image(VirtualDevice* pDevice) override;
2117 virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override;
2120 class SalInstanceScrolledWindow : public SalInstanceContainer, public virtual weld::ScrolledWindow
2122 private:
2123 VclPtr<VclScrolledWindow> m_xScrolledWindow;
2124 Link<ScrollBar*, void> m_aOrigVScrollHdl;
2125 Link<ScrollBar*, void> m_aOrigHScrollHdl;
2126 bool m_bUserManagedScrolling;
2128 DECL_LINK(VscrollHdl, ScrollBar*, void);
2129 DECL_LINK(HscrollHdl, ScrollBar*, void);
2131 static void customize_scrollbars(ScrollBar& rScrollBar, const Color& rButtonTextColor,
2132 const Color& rBackgroundColor, const Color& rShadowColor,
2133 const Color& rFaceColor);
2135 public:
2136 SalInstanceScrolledWindow(VclScrolledWindow* pScrolledWindow, SalInstanceBuilder* pBuilder,
2137 bool bTakeOwnership, bool bUserManagedScrolling);
2139 virtual void hadjustment_configure(int value, int lower, int upper, int step_increment,
2140 int page_increment, int page_size) override;
2141 virtual int hadjustment_get_value() const override;
2142 virtual void hadjustment_set_value(int value) override;
2143 virtual int hadjustment_get_upper() const override;
2144 virtual void hadjustment_set_upper(int upper) override;
2145 virtual int hadjustment_get_page_size() const override;
2146 virtual void hadjustment_set_page_size(int size) override;
2147 virtual void hadjustment_set_page_increment(int size) override;
2148 virtual void hadjustment_set_step_increment(int size) override;
2149 virtual void set_hpolicy(VclPolicyType eHPolicy) override;
2150 virtual VclPolicyType get_hpolicy() const override;
2152 virtual void vadjustment_configure(int value, int lower, int upper, int step_increment,
2153 int page_increment, int page_size) override;
2154 virtual int vadjustment_get_value() const override;
2155 virtual void vadjustment_set_value(int value) override;
2156 virtual int vadjustment_get_upper() const override;
2157 virtual void vadjustment_set_upper(int upper) override;
2158 virtual int vadjustment_get_lower() const override;
2159 virtual void vadjustment_set_lower(int lower) override;
2160 virtual int vadjustment_get_page_size() const override;
2161 virtual void vadjustment_set_page_size(int size) override;
2162 virtual void vadjustment_set_page_increment(int size) override;
2163 virtual void vadjustment_set_step_increment(int size) override;
2165 virtual void set_vpolicy(VclPolicyType eVPolicy) override;
2166 virtual VclPolicyType get_vpolicy() const override;
2167 virtual int get_scroll_thickness() const override;
2168 virtual void set_scroll_thickness(int nThickness) override;
2169 virtual void customize_scrollbars(const Color& rBackgroundColor, const Color& rShadowColor,
2170 const Color& rFaceColor) override;
2171 virtual ~SalInstanceScrolledWindow() override;
2174 class SalInstanceCalendar : public SalInstanceWidget, public virtual weld::Calendar
2176 private:
2177 VclPtr<::Calendar> m_xCalendar;
2179 DECL_LINK(SelectHdl, ::Calendar*, void);
2180 DECL_LINK(ActivateHdl, ::Calendar*, void);
2182 public:
2183 SalInstanceCalendar(::Calendar* pCalendar, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
2184 : SalInstanceWidget(pCalendar, pBuilder, bTakeOwnership)
2185 , m_xCalendar(pCalendar)
2187 m_xCalendar->SetSelectHdl(LINK(this, SalInstanceCalendar, SelectHdl));
2188 m_xCalendar->SetActivateHdl(LINK(this, SalInstanceCalendar, ActivateHdl));
2191 virtual void set_date(const Date& rDate) override { m_xCalendar->SetCurDate(rDate); }
2193 virtual Date get_date() const override { return m_xCalendar->GetFirstSelectedDate(); }
2195 virtual ~SalInstanceCalendar() override
2197 m_xCalendar->SetSelectHdl(Link<::Calendar*, void>());
2198 m_xCalendar->SetActivateHdl(Link<::Calendar*, void>());
2202 class SalInstanceFormattedSpinButton : public SalInstanceEntry,
2203 public virtual weld::FormattedSpinButton
2205 private:
2206 VclPtr<FormattedField> m_xButton;
2207 weld::EntryFormatter* m_pFormatter;
2208 Link<weld::Widget&, void> m_aLoseFocusHdl;
2210 DECL_LINK(UpDownHdl, SpinField&, void);
2211 DECL_LINK(LoseFocusHdl, Control&, void);
2213 public:
2214 SalInstanceFormattedSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder,
2215 bool bTakeOwnership);
2217 virtual void set_text(const OUString& rText) override;
2219 virtual void connect_changed(const Link<weld::Entry&, void>& rLink) override;
2221 virtual void connect_focus_out(const Link<weld::Widget&, void>& rLink) override;
2223 virtual void SetFormatter(weld::EntryFormatter* pFormatter) override;
2225 virtual void sync_value_from_formatter() override
2227 // no-op for gen
2230 virtual void sync_range_from_formatter() override
2232 // no-op for gen
2235 virtual void sync_increments_from_formatter() override
2237 // no-op for gen
2240 virtual Formatter& GetFormatter() override;
2242 virtual ~SalInstanceFormattedSpinButton() override;
2245 class SalInstanceVerticalNotebook : public SalInstanceWidget, public virtual weld::Notebook
2247 private:
2248 VclPtr<VerticalTabControl> m_xNotebook;
2249 mutable std::vector<std::unique_ptr<SalInstanceContainer>> m_aPages;
2251 DECL_LINK(DeactivatePageHdl, VerticalTabControl*, bool);
2252 DECL_LINK(ActivatePageHdl, VerticalTabControl*, void);
2254 public:
2255 SalInstanceVerticalNotebook(VerticalTabControl* pNotebook, SalInstanceBuilder* pBuilder,
2256 bool bTakeOwnership);
2258 virtual int get_current_page() const override;
2260 virtual OString get_page_ident(int nPage) const override;
2262 virtual OString get_current_page_ident() const override;
2264 virtual int get_page_index(const OString& rIdent) const override;
2266 virtual weld::Container* get_page(const OString& rIdent) const override;
2268 virtual void set_current_page(int nPage) override;
2270 virtual void set_current_page(const OString& rIdent) override;
2272 virtual void remove_page(const OString& rIdent) override;
2274 virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override;
2276 virtual int get_n_pages() const override;
2278 virtual void set_tab_label_text(const OString& rIdent, const OUString& rText) override;
2280 virtual OUString get_tab_label_text(const OString& rIdent) const override;
2282 virtual void set_show_tabs(bool /*bShow*/) override;
2284 virtual ~SalInstanceVerticalNotebook() override;
2287 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */