basctl/source/inc/objectbrowser.hxx | 1 cui/inc/dlgname.hxx | 1 cui/source/dialogs/screenshotannotationdlg.cxx | 1 cui/source/inc/DiagramDialog.hxx | 1 cui/source/inc/GraphicsTestsDialog.hxx | 1 cui/source/inc/MacroManagerDialog.hxx | 1 cui/source/inc/QrCodeGenDialog.hxx | 1 cui/source/inc/SignSignatureLineDialog.hxx | 1 cui/source/inc/SignatureLineDialog.hxx | 1 cui/source/inc/cfg.hxx | 1 cui/source/inc/cfgutil.hxx | 1 cui/source/inc/cuiimapwnd.hxx | 1 cui/source/inc/postdlg.hxx | 1 dbaccess/source/ui/app/AppDetailView.hxx | 1 dbaccess/source/ui/dlg/sqlmessage.cxx | 1 dbaccess/source/ui/inc/TableDesignHelpBar.hxx | 1 dbaccess/source/ui/inc/directsql.hxx | 1 desktop/source/deployment/gui/dp_gui_dialog2.hxx | 1 desktop/source/deployment/gui/dp_gui_updatedialog.hxx | 1 desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx | 1 desktop/source/deployment/gui/license_dialog.cxx | 1 extensions/source/propctrlr/inspectorhelpwindow.hxx | 1 extensions/source/propctrlr/standardcontrol.hxx | 1 filter/source/xsltdialog/xmlfiltertabpagebasic.hxx | 1 formula/source/ui/dlg/formula.cxx | 1 include/sfx2/devtools/ObjectInspectorWidgets.hxx | 1 include/sfx2/dinfdlg.hxx | 1 include/sfx2/infobar.hxx | 1 include/svtools/editbrowsebox.hxx | 1 include/vcl/jsdialog/executor.hxx | 1 include/vcl/weld/TextView.hxx | 108 ++++++++++ include/vcl/weld/weld.hxx | 110 ----------- sc/source/ui/inc/dwfunctr.hxx | 1 sc/source/ui/inc/navipi.hxx | 1 sc/source/ui/inc/scendlg.hxx | 1 sc/source/ui/inc/tpusrlst.hxx | 1 sc/source/ui/inc/validate.hxx | 1 sc/source/ui/view/viewfunc.cxx | 1 sd/source/ui/inc/layeroptionsdlg.hxx | 1 sfx2/inc/checkin.hxx | 1 sfx2/source/inc/versdlg.hxx | 1 svx/source/inc/datanavi.hxx | 1 sw/source/ui/config/mailconfigpage.cxx | 1 sw/source/ui/dbui/mmgreetingspage.hxx | 1 sw/source/ui/dbui/mmoutputtypepage.cxx | 1 sw/source/ui/envelp/swuilabimp.hxx | 1 sw/source/ui/fldui/fldvar.hxx | 1 sw/source/uibase/inc/copyfielddlg.hxx | 1 sw/source/uibase/inc/dbinsdlg.hxx | 1 sw/source/uibase/inc/envlop.hxx | 1 sw/source/uibase/inc/frmpage.hxx | 1 sw/source/uibase/inc/inpdlg.hxx | 1 sw/source/uibase/inc/javaedit.hxx | 1 sw/source/uibase/sidebar/CommentsPanel.hxx | 1 vcl/Library_vcl.mk | 1 vcl/inc/qt5/QtInstanceBuilder.hxx | 1 vcl/inc/qt5/QtInstanceTextView.hxx | 2 vcl/inc/salvtables.hxx | 1 vcl/source/weld/TextView.cxx | 42 ++++ vcl/unx/gtk3/gtkinst.cxx | 1 xmlsecurity/inc/certificateviewer.hxx | 1 61 files changed, 209 insertions(+), 110 deletions(-)
New commits: commit 1db7d671f369eb84c5139e911c3d9077716a23d7 Author: Michael Weghorn <[email protected]> AuthorDate: Sat Jan 3 09:16:08 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Sat Jan 3 12:10:26 2026 +0100 weld: Move weld::TextView to own header/source Move the class out of weld.hxx into its own header and source file, in order to make it easier to keep an overview and to avoid having to recompile ~all UI code when the class is modified. Change-Id: I05a3ae87147fedfa39f4acd8c3f744fd88a83e5e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196442 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/basctl/source/inc/objectbrowser.hxx b/basctl/source/inc/objectbrowser.hxx index 0db68b96dfc0..9c651f3a871c 100644 --- a/basctl/source/inc/objectbrowser.hxx +++ b/basctl/source/inc/objectbrowser.hxx @@ -21,6 +21,7 @@ #include <sfx2/sfxsids.hrc> #include <sfx2/viewfrm.hxx> #include <vcl/weld/ComboBox.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> diff --git a/cui/inc/dlgname.hxx b/cui/inc/dlgname.hxx index 733cecec7915..6e012352fd2f 100644 --- a/cui/inc/dlgname.hxx +++ b/cui/inc/dlgname.hxx @@ -20,6 +20,7 @@ #include <vcl/formatter.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx index e07d8932b3c9..e1967c645981 100644 --- a/cui/source/dialogs/screenshotannotationdlg.cxx +++ b/cui/source/dialogs/screenshotannotationdlg.cxx @@ -44,6 +44,7 @@ #include <vcl/svapp.hxx> #include <vcl/salgtype.hxx> #include <vcl/virdev.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/customweld.hxx> #include <vcl/weld/weld.hxx> diff --git a/cui/source/inc/DiagramDialog.hxx b/cui/source/inc/DiagramDialog.hxx index 3b4acdf9df77..95ed28825bd0 100644 --- a/cui/source/inc/DiagramDialog.hxx +++ b/cui/source/inc/DiagramDialog.hxx @@ -11,6 +11,7 @@ #include <tools/link.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> diff --git a/cui/source/inc/GraphicsTestsDialog.hxx b/cui/source/inc/GraphicsTestsDialog.hxx index 684ca6c7aa4a..db26c45ad3ce 100644 --- a/cui/source/inc/GraphicsTestsDialog.hxx +++ b/cui/source/inc/GraphicsTestsDialog.hxx @@ -11,6 +11,7 @@ #include <vcl/bitmap.hxx> #include <vcl/weld/Builder.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include <tools/link.hxx> diff --git a/cui/source/inc/MacroManagerDialog.hxx b/cui/source/inc/MacroManagerDialog.hxx index 61a2cc279ea5..7173fc041ac4 100644 --- a/cui/source/inc/MacroManagerDialog.hxx +++ b/cui/source/inc/MacroManagerDialog.hxx @@ -16,6 +16,7 @@ #include <svx/passwd.hxx> #include <svl/lstner.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <com/sun/star/beans/XPropertySet.hpp> diff --git a/cui/source/inc/QrCodeGenDialog.hxx b/cui/source/inc/QrCodeGenDialog.hxx index 61a6b60cacca..c8abde8f4c88 100644 --- a/cui/source/inc/QrCodeGenDialog.hxx +++ b/cui/source/inc/QrCodeGenDialog.hxx @@ -12,6 +12,7 @@ #include <vcl/weld/ComboBox.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include <com/sun/star/frame/XModel.hpp> diff --git a/cui/source/inc/SignSignatureLineDialog.hxx b/cui/source/inc/SignSignatureLineDialog.hxx index 7c894a16a0b3..446f4b929503 100644 --- a/cui/source/inc/SignSignatureLineDialog.hxx +++ b/cui/source/inc/SignSignatureLineDialog.hxx @@ -14,6 +14,7 @@ #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/security/XCertificate.hpp> #include <com/sun/star/uno/Reference.hxx> +#include <vcl/weld/TextView.hxx> class SignSignatureLineDialog : public SignatureLineDialogBase { diff --git a/cui/source/inc/SignatureLineDialog.hxx b/cui/source/inc/SignatureLineDialog.hxx index e686cb4a4123..9f33f6b1155e 100644 --- a/cui/source/inc/SignatureLineDialog.hxx +++ b/cui/source/inc/SignatureLineDialog.hxx @@ -12,6 +12,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/uno/Reference.hxx> +#include <vcl/weld/TextView.hxx> class SignatureLineDialog : public SignatureLineDialogBase { diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index 0ee2d161fc28..c9cfad1ca172 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -22,6 +22,7 @@ #include <vcl/timer.hxx> #include <vcl/weld/ComboBox.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> #include <vcl/weld/weldutils.hxx> diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx index 746a3c1d4f3c..f6170f8fab34 100644 --- a/cui/source/inc/cfgutil.hxx +++ b/cui/source/inc/cfgutil.hxx @@ -31,6 +31,7 @@ #include <com/sun/star/script/browse/XBrowseNode.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> #include <config_features.h> diff --git a/cui/source/inc/cuiimapwnd.hxx b/cui/source/inc/cuiimapwnd.hxx index 6e1fe8743240..2a414722491e 100644 --- a/cui/source/inc/cuiimapwnd.hxx +++ b/cui/source/inc/cuiimapwnd.hxx @@ -20,6 +20,7 @@ #include <vcl/weld/ComboBox.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include <sfx2/frame.hxx> diff --git a/cui/source/inc/postdlg.hxx b/cui/source/inc/postdlg.hxx index 5c6da9c75abb..cdba5154e7ba 100644 --- a/cui/source/inc/postdlg.hxx +++ b/cui/source/inc/postdlg.hxx @@ -23,6 +23,7 @@ #include <string_view> #include <sfx2/basedlgs.hxx> +#include <vcl/weld/TextView.hxx> // class SvxPostItDialog ------------------------------------------------- /* diff --git a/dbaccess/source/ui/app/AppDetailView.hxx b/dbaccess/source/ui/app/AppDetailView.hxx index 9b0df37bcfdd..117cc9eb79f4 100644 --- a/dbaccess/source/ui/app/AppDetailView.hxx +++ b/dbaccess/source/ui/app/AppDetailView.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/ucb/XContent.hpp> #include <com/sun/star/sdb/application/NamedDatabaseObject.hpp> #include <vcl/mnemonic.hxx> +#include <vcl/weld/TextView.hxx> #include <IClipBoardTest.hxx> #include "AppTitleWindow.hxx" #include <AppElementType.hxx> diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx index 423740380007..056102944edf 100644 --- a/dbaccess/source/ui/dlg/sqlmessage.cxx +++ b/dbaccess/source/ui/dlg/sqlmessage.cxx @@ -25,6 +25,7 @@ #include <utility> #include <vcl/stdtext.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> #include <osl/diagnose.h> diff --git a/dbaccess/source/ui/inc/TableDesignHelpBar.hxx b/dbaccess/source/ui/inc/TableDesignHelpBar.hxx index cc5338cb238b..b430a2b4a03e 100644 --- a/dbaccess/source/ui/inc/TableDesignHelpBar.hxx +++ b/dbaccess/source/ui/inc/TableDesignHelpBar.hxx @@ -18,6 +18,7 @@ */ #pragma once +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include "IClipBoardTest.hxx" diff --git a/dbaccess/source/ui/inc/directsql.hxx b/dbaccess/source/ui/inc/directsql.hxx index 17d78ebd104f..58efdcbb97f9 100644 --- a/dbaccess/source/ui/inc/directsql.hxx +++ b/dbaccess/source/ui/inc/directsql.hxx @@ -23,6 +23,7 @@ #include <vcl/weld/ComboBox.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include <deque> #include <string_view> diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 9cd4f60fb0f6..a107e2d8dfdd 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -23,6 +23,7 @@ #include <vcl/idle.hxx> #include <vcl/locktoplevels.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/customweld.hxx> #include <vcl/weld/weld.hxx> diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx index 995385d1adb1..450ff943b18b 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx @@ -28,6 +28,7 @@ #include <rtl/ustring.hxx> #include <tools/link.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx index 34c6a0bf4b39..effa2e83bbd6 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx @@ -21,6 +21,7 @@ #include <sal/config.h> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include <rtl/ref.hxx> diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx index 1cd60b0bb10c..e975d186fe3f 100644 --- a/desktop/source/deployment/gui/license_dialog.cxx +++ b/desktop/source/deployment/gui/license_dialog.cxx @@ -24,6 +24,7 @@ #include <vcl/svapp.hxx> #include <vcl/threadex.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include <cppuhelper/supportsservice.hxx> diff --git a/extensions/source/propctrlr/inspectorhelpwindow.hxx b/extensions/source/propctrlr/inspectorhelpwindow.hxx index 632d252a0808..4440949fad58 100644 --- a/extensions/source/propctrlr/inspectorhelpwindow.hxx +++ b/extensions/source/propctrlr/inspectorhelpwindow.hxx @@ -19,6 +19,7 @@ #pragma once #include <vcl/weld/Builder.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> namespace pcr diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx index 08147130de4f..90340544ee6d 100644 --- a/extensions/source/propctrlr/standardcontrol.hxx +++ b/extensions/source/propctrlr/standardcontrol.hxx @@ -29,6 +29,7 @@ #include <svtools/ctrlbox.hxx> #include <svx/colorbox.hxx> #include <vcl/weld/MetricSpinButton.hxx> +#include <vcl/weld/TextView.hxx> namespace pcr { diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx index 4c78315d77c6..1959db988a29 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx +++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.hxx @@ -20,6 +20,7 @@ #include <vcl/weld/Builder.hxx> #include <vcl/weld/ComboBox.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> class filter_info_impl; diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index f4fdc1955a4d..d937656d2e0d 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -20,6 +20,7 @@ #include <memory> #include <sfx2/viewfrm.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include <sal/log.hxx> diff --git a/include/sfx2/devtools/ObjectInspectorWidgets.hxx b/include/sfx2/devtools/ObjectInspectorWidgets.hxx index 57d744f2ab42..56d31a8c43a2 100644 --- a/include/sfx2/devtools/ObjectInspectorWidgets.hxx +++ b/include/sfx2/devtools/ObjectInspectorWidgets.hxx @@ -12,6 +12,7 @@ #include <sfx2/dllapi.h> #include <vcl/weld/Builder.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index ce98b7cc1e32..6f0b9ef67590 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -35,6 +35,7 @@ #include <vcl/idle.hxx> #include <vcl/weld/Builder.hxx> #include <vcl/weld/ScrolledWindow.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weldutils.hxx> #include <sfx2/tabdlg.hxx> diff --git a/include/sfx2/infobar.hxx b/include/sfx2/infobar.hxx index eb09491c3081..5e8c0d4c3e1e 100644 --- a/include/sfx2/infobar.hxx +++ b/include/sfx2/infobar.hxx @@ -16,6 +16,7 @@ #include <sfx2/childwin.hxx> #include <sfx2/dllapi.h> #include <vcl/InterimItemWindow.hxx> +#include <vcl/weld/TextView.hxx> // These must match the values in offapi/com/sun/star/frame/InfobarType.idl enum class InfobarType diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx index a59de6f2ffca..a01c7582f057 100644 --- a/include/svtools/editbrowsebox.hxx +++ b/include/svtools/editbrowsebox.hxx @@ -28,6 +28,7 @@ #include <tools/lineend.hxx> #include <vcl/InterimItemWindow.hxx> #include <vcl/weld/ComboBox.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weldutils.hxx> #include <o3tl/typed_flags_set.hxx> diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx index 2360ec2fdacc..9496f5ae44eb 100644 --- a/include/vcl/jsdialog/executor.hxx +++ b/include/vcl/jsdialog/executor.hxx @@ -14,6 +14,7 @@ #include <vcl/weld/ComboBox.hxx> #include <vcl/weld/IconView.hxx> #include <vcl/weld/ScrolledWindow.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> #include <unordered_map> diff --git a/include/vcl/weld/TextView.hxx b/include/vcl/weld/TextView.hxx new file mode 100644 index 000000000000..b92edf238853 --- /dev/null +++ b/include/vcl/weld/TextView.hxx @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <vcl/dllapi.h> +#include <vcl/weld/weld.hxx> + +namespace weld +{ +class VCL_DLLPUBLIC TextView : virtual public Widget +{ + friend class ::LOKTrigger; + +private: + OUString m_sSavedValue; + +protected: + Link<TextView&, void> m_aChangeHdl; + Link<TextView&, void> m_aVValueChangeHdl; + Link<TextView&, void> m_aCursorPositionHdl; + + void signal_changed() { m_aChangeHdl.Call(*this); } + + void signal_cursor_position() + { + if (notify_events_disabled()) + return; + m_aCursorPositionHdl.Call(*this); + } + + void signal_vadjustment_value_changed() { m_aVValueChangeHdl.Call(*this); } + + virtual void do_set_text(const OUString& rText) = 0; + virtual void do_select_region(int nStartPos, int nEndPos) = 0; + virtual void do_replace_selection(const OUString& rText) = 0; + +public: + void set_text(const OUString& rText); + virtual OUString get_text() const = 0; + + // if nStartPos or nEndPos is -1 the max available text pos will be used + void select_region(int nStartPos, int nEndPos); + + // returns true if the selection has nonzero length + virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0; + + void replace_selection(const OUString& rText); + + virtual void set_editable(bool bEditable) = 0; + virtual bool get_editable() const = 0; + virtual void set_monospace(bool bMonospace) = 0; + // The maximum length of the entry. Use 0 for no maximum + virtual void set_max_length(int nChars) = 0; + int get_height_rows(int nRows) const; + + // font size is in points, not pixels, e.g. see Window::[G]etPointFont + virtual void set_font(const vcl::Font& rFont) = 0; + + /* + Typically you want to avoid the temptation of customizing + font colors + */ + virtual void set_font_color(const Color& rColor) = 0; + + void save_value() { m_sSavedValue = get_text(); } + bool get_value_changed_from_saved() const { return m_sSavedValue != get_text(); } + + void connect_changed(const Link<TextView&, void>& rLink) { m_aChangeHdl = rLink; } + virtual void connect_cursor_position(const Link<TextView&, void>& rLink) + { + m_aCursorPositionHdl = rLink; + } + + // returns true if pressing up would move the cursor + // doesn't matter if that move is to a previous line or to the start of the + // current line just so long as the cursor would move + virtual bool can_move_cursor_with_up() const = 0; + + // returns true if pressing down would move the cursor + // doesn't matter if that move is to a next line or to the end of the + // current line just so long as the cursor would move + virtual bool can_move_cursor_with_down() const = 0; + + virtual void cut_clipboard() = 0; + virtual void copy_clipboard() = 0; + virtual void paste_clipboard() = 0; + + virtual void set_alignment(TxtAlign eXAlign) = 0; + + virtual int vadjustment_get_value() const = 0; + virtual int vadjustment_get_upper() const = 0; + virtual int vadjustment_get_page_size() const = 0; + virtual void vadjustment_set_value(int value) = 0; + void connect_vadjustment_value_changed(const Link<TextView&, void>& rLink) + { + m_aVValueChangeHdl = rLink; + } +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/vcl/weld/weld.hxx b/include/vcl/weld/weld.hxx index 816a63bb4234..d9841a1d6289 100644 --- a/include/vcl/weld/weld.hxx +++ b/include/vcl/weld/weld.hxx @@ -1268,116 +1268,6 @@ public: virtual void set_font_color(const Color& rColor) = 0; }; -class VCL_DLLPUBLIC TextView : virtual public Widget -{ - friend class ::LOKTrigger; - -private: - OUString m_sSavedValue; - -protected: - Link<TextView&, void> m_aChangeHdl; - Link<TextView&, void> m_aVValueChangeHdl; - Link<TextView&, void> m_aCursorPositionHdl; - - void signal_changed() { m_aChangeHdl.Call(*this); } - - void signal_cursor_position() - { - if (notify_events_disabled()) - return; - m_aCursorPositionHdl.Call(*this); - } - - void signal_vadjustment_value_changed() { m_aVValueChangeHdl.Call(*this); } - - virtual void do_set_text(const OUString& rText) = 0; - virtual void do_select_region(int nStartPos, int nEndPos) = 0; - virtual void do_replace_selection(const OUString& rText) = 0; - -public: - void set_text(const OUString& rText) - { - disable_notify_events(); - do_set_text(rText); - enable_notify_events(); - } - - virtual OUString get_text() const = 0; - - // if nStartPos or nEndPos is -1 the max available text pos will be used - void select_region(int nStartPos, int nEndPos) - { - disable_notify_events(); - do_select_region(nStartPos, nEndPos); - enable_notify_events(); - } - - // returns true if the selection has nonzero length - virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0; - - void replace_selection(const OUString& rText) - { - disable_notify_events(); - do_replace_selection(rText); - enable_notify_events(); - } - - virtual void set_editable(bool bEditable) = 0; - virtual bool get_editable() const = 0; - virtual void set_monospace(bool bMonospace) = 0; - // The maximum length of the entry. Use 0 for no maximum - virtual void set_max_length(int nChars) = 0; - int get_height_rows(int nRows) const - { - //can improve this if needed - return get_text_height() * nRows; - } - - // font size is in points, not pixels, e.g. see Window::[G]etPointFont - virtual void set_font(const vcl::Font& rFont) = 0; - - /* - Typically you want to avoid the temptation of customizing - font colors - */ - virtual void set_font_color(const Color& rColor) = 0; - - void save_value() { m_sSavedValue = get_text(); } - bool get_value_changed_from_saved() const { return m_sSavedValue != get_text(); } - - void connect_changed(const Link<TextView&, void>& rLink) { m_aChangeHdl = rLink; } - virtual void connect_cursor_position(const Link<TextView&, void>& rLink) - { - m_aCursorPositionHdl = rLink; - } - - // returns true if pressing up would move the cursor - // doesn't matter if that move is to a previous line or to the start of the - // current line just so long as the cursor would move - virtual bool can_move_cursor_with_up() const = 0; - - // returns true if pressing down would move the cursor - // doesn't matter if that move is to a next line or to the end of the - // current line just so long as the cursor would move - virtual bool can_move_cursor_with_down() const = 0; - - virtual void cut_clipboard() = 0; - virtual void copy_clipboard() = 0; - virtual void paste_clipboard() = 0; - - virtual void set_alignment(TxtAlign eXAlign) = 0; - - virtual int vadjustment_get_value() const = 0; - virtual int vadjustment_get_upper() const = 0; - virtual int vadjustment_get_page_size() const = 0; - virtual void vadjustment_set_value(int value) = 0; - void connect_vadjustment_value_changed(const Link<TextView&, void>& rLink) - { - m_aVValueChangeHdl = rLink; - } -}; - class VCL_DLLPUBLIC Expander : virtual public Widget { Link<Expander&, void> m_aExpandedHdl; diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx index 316ca2340a1d..34e19f95f68c 100644 --- a/sc/source/ui/inc/dwfunctr.hxx +++ b/sc/source/ui/inc/dwfunctr.hxx @@ -22,6 +22,7 @@ #include <sfx2/sidebar/PanelLayout.hxx> #include <unordered_map> #include <sfx2/bindings.hxx> +#include <vcl/weld/TextView.hxx> class ScFuncDesc; namespace formula { class IFunctionDescription; } diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx index aa38a35c4b61..d2aa58405331 100644 --- a/sc/source/ui/inc/navipi.hxx +++ b/sc/source/ui/inc/navipi.hxx @@ -25,6 +25,7 @@ #include <sfx2/childwin.hxx> #include <sfx2/navigat.hxx> #include <sfx2/sidebar/PanelLayout.hxx> +#include <vcl/weld/TextView.hxx> #include <rangeutl.hxx> #include "content.hxx" diff --git a/sc/source/ui/inc/scendlg.hxx b/sc/source/ui/inc/scendlg.hxx index 6302cb9e321c..195e2f718a94 100644 --- a/sc/source/ui/inc/scendlg.hxx +++ b/sc/source/ui/inc/scendlg.hxx @@ -20,6 +20,7 @@ #pragma once #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> enum class ScScenarioFlags; diff --git a/sc/source/ui/inc/tpusrlst.hxx b/sc/source/ui/inc/tpusrlst.hxx index 96d75eca1e7f..97a12db04093 100644 --- a/sc/source/ui/inc/tpusrlst.hxx +++ b/sc/source/ui/inc/tpusrlst.hxx @@ -20,6 +20,7 @@ #pragma once #include <sfx2/tabdlg.hxx> +#include <vcl/weld/TextView.hxx> class ScUserList; class ScDocument; diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx index 21884ec97c83..e8c8587db231 100644 --- a/sc/source/ui/inc/validate.hxx +++ b/sc/source/ui/inc/validate.hxx @@ -21,6 +21,7 @@ #include <sfx2/tabdlg.hxx> #include <vcl/weld/ComboBox.hxx> +#include <vcl/weld/TextView.hxx> #include "anyrefdg.hxx" #include <sc.hrc> diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 7e370e7258c8..70fc3b8bc454 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -39,6 +39,7 @@ #include <unotools/charclass.hxx> #include <vcl/uitest/logger.hxx> #include <vcl/uitest/eventdescription.hxx> +#include <vcl/weld/TextView.hxx> #include <osl/diagnose.h> #include <viewfunc.hxx> diff --git a/sd/source/ui/inc/layeroptionsdlg.hxx b/sd/source/ui/inc/layeroptionsdlg.hxx index 84dc4af2c13c..a55dc33e5de2 100644 --- a/sd/source/ui/inc/layeroptionsdlg.hxx +++ b/sd/source/ui/inc/layeroptionsdlg.hxx @@ -22,6 +22,7 @@ #include <sddllapi.h> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> class SfxItemSet; diff --git a/sfx2/inc/checkin.hxx b/sfx2/inc/checkin.hxx index 1ff4a7ffb1a8..f0298611894a 100644 --- a/sfx2/inc/checkin.hxx +++ b/sfx2/inc/checkin.hxx @@ -10,6 +10,7 @@ #pragma once #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> class SfxCheckinDialog final : public weld::GenericDialogController diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx index ba854cf3a353..e54cbe3ac5d5 100644 --- a/sfx2/source/inc/versdlg.hxx +++ b/sfx2/source/inc/versdlg.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SFX2_SOURCE_INC_VERSDLG_HXX #include <sfx2/basedlgs.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx index 1d8d8cc326af..475801715b5b 100644 --- a/svx/source/inc/datanavi.hxx +++ b/svx/source/inc/datanavi.hxx @@ -26,6 +26,7 @@ #include <vcl/transfer.hxx> #include <vcl/weld/ComboBox.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> #include <svtools/inettbc.hxx> diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx index 0b6b480b3d3b..97b9653f8509 100644 --- a/sw/source/ui/config/mailconfigpage.cxx +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -24,6 +24,7 @@ #include <officecfg/Office/Writer.hxx> #include <rtl/ustrbuf.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/mail/MailServiceType.hpp> diff --git a/sw/source/ui/dbui/mmgreetingspage.hxx b/sw/source/ui/dbui/mmgreetingspage.hxx index ee4213351d82..9bed0e7e5bd6 100644 --- a/sw/source/ui/dbui/mmgreetingspage.hxx +++ b/sw/source/ui/dbui/mmgreetingspage.hxx @@ -23,6 +23,7 @@ #include <sfx2/basedlgs.hxx> #include <mailmergehelper.hxx> #include <vcl/weld/ComboBox.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include <mailmergewizard.hxx> diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index 0f6bfdd3eb73..fc9f5af8c44a 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/mail/XSmtpService.hpp> #include <vcl/idle.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include <swunohelper.hxx> diff --git a/sw/source/ui/envelp/swuilabimp.hxx b/sw/source/ui/envelp/swuilabimp.hxx index 222c9fd911cc..8ce10b9cd9f6 100644 --- a/sw/source/ui/envelp/swuilabimp.hxx +++ b/sw/source/ui/envelp/swuilabimp.hxx @@ -22,6 +22,7 @@ #include <labimg.hxx> #include <labrec.hxx> #include <sfx2/tabdlg.hxx> +#include <vcl/weld/TextView.hxx> class SwLabPage : public SfxTabPage { diff --git a/sw/source/ui/fldui/fldvar.hxx b/sw/source/ui/fldui/fldvar.hxx index 5f9e61bae2f2..9fdf67d8fa41 100644 --- a/sw/source/ui/fldui/fldvar.hxx +++ b/sw/source/ui/fldui/fldvar.hxx @@ -20,6 +20,7 @@ #define INCLUDED_SW_SOURCE_UI_FLDUI_FLDVAR_HXX #include <sfx2/tabdlg.hxx> +#include <vcl/weld/TextView.hxx> #include "fldpage.hxx" #include <condedit.hxx> diff --git a/sw/source/uibase/inc/copyfielddlg.hxx b/sw/source/uibase/inc/copyfielddlg.hxx index 3a3db66e7379..6dd65731e97a 100644 --- a/sw/source/uibase/inc/copyfielddlg.hxx +++ b/sw/source/uibase/inc/copyfielddlg.hxx @@ -19,6 +19,7 @@ #pragma once #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include <condedit.hxx> diff --git a/sw/source/uibase/inc/dbinsdlg.hxx b/sw/source/uibase/inc/dbinsdlg.hxx index fee61faa7ea3..04eff37ecc0a 100644 --- a/sw/source/uibase/inc/dbinsdlg.hxx +++ b/sw/source/uibase/inc/dbinsdlg.hxx @@ -22,6 +22,7 @@ #include <utility> #include <vcl/weld/ComboBox.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> #include <sfx2/basedlgs.hxx> diff --git a/sw/source/uibase/inc/envlop.hxx b/sw/source/uibase/inc/envlop.hxx index 439765019cf9..2c75acb9f947 100644 --- a/sw/source/uibase/inc/envlop.hxx +++ b/sw/source/uibase/inc/envlop.hxx @@ -22,6 +22,7 @@ #include <sfx2/tabdlg.hxx> #include <vcl/weld/ComboBox.hxx> #include <vcl/weld/MetricSpinButton.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/customweld.hxx> #include <vcl/weld/weld.hxx> #include "envimg.hxx" diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx index 060421803212..26e35cb4011f 100644 --- a/sw/source/uibase/inc/frmpage.hxx +++ b/sw/source/uibase/inc/frmpage.hxx @@ -27,6 +27,7 @@ #include <svx/swframeexample.hxx> #include <vcl/weld/ComboBox.hxx> #include <vcl/weld/MetricSpinButton.hxx> +#include <vcl/weld/TextView.hxx> #include <swtypes.hxx> #include "bmpwin.hxx" #include "prcntfld.hxx" diff --git a/sw/source/uibase/inc/inpdlg.hxx b/sw/source/uibase/inc/inpdlg.hxx index d300bb7047c4..554293ddc398 100644 --- a/sw/source/uibase/inc/inpdlg.hxx +++ b/sw/source/uibase/inc/inpdlg.hxx @@ -20,6 +20,7 @@ #define INCLUDED_SW_SOURCE_UIBASE_INC_INPDLG_HXX #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> class SwInputField; diff --git a/sw/source/uibase/inc/javaedit.hxx b/sw/source/uibase/inc/javaedit.hxx index 52a556368ec9..41e48c09af1d 100644 --- a/sw/source/uibase/inc/javaedit.hxx +++ b/sw/source/uibase/inc/javaedit.hxx @@ -19,6 +19,7 @@ #pragma once #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> class SwWrtShell; diff --git a/sw/source/uibase/sidebar/CommentsPanel.hxx b/sw/source/uibase/sidebar/CommentsPanel.hxx index d3a585916c5f..fe569e205492 100644 --- a/sw/source/uibase/sidebar/CommentsPanel.hxx +++ b/sw/source/uibase/sidebar/CommentsPanel.hxx @@ -30,6 +30,7 @@ #include <AnnotationWin.hxx> #include <svl/poolitem.hxx> #include <tools/link.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/weld.hxx> #include <PostItMgr.hxx> #include <postithelper.hxx> diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index f7c0353c508b..d5bf354e4f65 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -591,6 +591,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/weld/IconView \ vcl/source/weld/ItemView \ vcl/source/weld/MetricSpinButton \ + vcl/source/weld/TextView \ vcl/source/weld/TreeView \ vcl/source/weld/weldutils \ vcl/backendtest/outputdevice/bitmap \ diff --git a/vcl/inc/qt5/QtInstanceBuilder.hxx b/vcl/inc/qt5/QtInstanceBuilder.hxx index dfeb9e260a40..813fb04ce3f1 100644 --- a/vcl/inc/qt5/QtInstanceBuilder.hxx +++ b/vcl/inc/qt5/QtInstanceBuilder.hxx @@ -21,6 +21,7 @@ #include <vcl/weld/ComboBox.hxx> #include <vcl/weld/EntryTreeView.hxx> #include <vcl/weld/MetricSpinButton.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> diff --git a/vcl/inc/qt5/QtInstanceTextView.hxx b/vcl/inc/qt5/QtInstanceTextView.hxx index 458a41304c1c..2b6af1a6d196 100644 --- a/vcl/inc/qt5/QtInstanceTextView.hxx +++ b/vcl/inc/qt5/QtInstanceTextView.hxx @@ -11,6 +11,8 @@ #include "QtInstanceWidget.hxx" +#include <vcl/weld/TextView.hxx> + #include <QtWidgets/QPlainTextEdit> class QtInstanceTextView : public QtInstanceWidget, public virtual weld::TextView diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index db6e715a8b0b..0c0d833d2c60 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -16,6 +16,7 @@ #include <vcl/weld/EntryTreeView.hxx> #include <vcl/weld/MetricSpinButton.hxx> #include <vcl/weld/ScrolledWindow.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx> #include <vcl/svapp.hxx> diff --git a/vcl/source/weld/TextView.cxx b/vcl/source/weld/TextView.cxx new file mode 100644 index 000000000000..55c390f78b08 --- /dev/null +++ b/vcl/source/weld/TextView.cxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <vcl/weld/TextView.hxx> + +namespace weld +{ +void weld::TextView::set_text(const OUString& rText) +{ + disable_notify_events(); + do_set_text(rText); + enable_notify_events(); +} + +void weld::TextView::select_region(int nStartPos, int nEndPos) +{ + disable_notify_events(); + do_select_region(nStartPos, nEndPos); + enable_notify_events(); +} + +void weld::TextView::replace_selection(const OUString& rText) +{ + disable_notify_events(); + do_replace_selection(rText); + enable_notify_events(); +} + +int weld::TextView::get_height_rows(int nRows) const +{ + // can improve this if needed + return get_text_height() * nRows; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index eebc9a461ff8..47d90e0eb8c2 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -38,6 +38,7 @@ #include <vcl/toolkit/floatwin.hxx> #include <vcl/weld/MetricSpinButton.hxx> #include <vcl/weld/ScrolledWindow.hxx> +#include <vcl/weld/TextView.hxx> #include <unx/genpspgraphics.h> #include <rtl/strbuf.hxx> #include <sal/log.hxx> diff --git a/xmlsecurity/inc/certificateviewer.hxx b/xmlsecurity/inc/certificateviewer.hxx index da8066115349..363f8d1fe887 100644 --- a/xmlsecurity/inc/certificateviewer.hxx +++ b/xmlsecurity/inc/certificateviewer.hxx @@ -22,6 +22,7 @@ #include <utility> #include <vcl/weld/Builder.hxx> #include <vcl/weld/DialogController.hxx> +#include <vcl/weld/TextView.hxx> #include <vcl/weld/TreeView.hxx> #include <vcl/weld/weld.hxx>
