include/vcl/window.hxx | 1 toolkit/source/awt/vclxtoolkit.cxx | 148 ++++++++++++++++++------------------- vcl/source/window/window.cxx | 6 + 3 files changed, 80 insertions(+), 75 deletions(-)
New commits: commit 3e6b8ab487dd553e6b852bf5e22d7c5b47361868 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Aug 8 10:25:48 2025 +0200 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sat Aug 9 09:20:50 2025 +0200 simplify - no need to explicitly cast to u16string_view Change-Id: I2c187a1a01fa3e570135eb76cfbd20d03bafdcbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189163 Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> Tested-by: Jenkins diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index c35dac2bf0da..9c8658695422 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -696,80 +696,80 @@ struct ComponentInfo WindowType nWinType; }; -ComponentInfo const aComponentInfos [] = -{ - { std::u16string_view(u"animatedimages"), WindowType::CONTROL }, - { std::u16string_view(u"buttondialog"), WindowType::BUTTONDIALOG }, - { std::u16string_view(u"cancelbutton"), WindowType::CANCELBUTTON }, - { std::u16string_view(u"checkbox"), WindowType::CHECKBOX }, - { std::u16string_view(u"combobox"), WindowType::COMBOBOX }, - { std::u16string_view(u"control"), WindowType::CONTROL }, - { std::u16string_view(u"currencybox"), WindowType::CURRENCYBOX }, - { std::u16string_view(u"currencyfield"), WindowType::CURRENCYFIELD }, - { std::u16string_view(u"datebox"), WindowType::DATEBOX }, - { std::u16string_view(u"datefield"), WindowType::CONTROL }, - { std::u16string_view(u"dialog"), WindowType::DIALOG }, - { std::u16string_view(u"dockingarea"), WindowType::DOCKINGAREA }, - { std::u16string_view(u"dockingwindow"), WindowType::DOCKINGWINDOW }, - { std::u16string_view(u"edit"), WindowType::EDIT }, - { std::u16string_view(u"errorbox"), WindowType::ERRORBOX }, - { std::u16string_view(u"filecontrol"), WindowType::CONTROL }, - { std::u16string_view(u"fixedbitmap"), WindowType::FIXEDBITMAP }, - { std::u16string_view(u"fixedhyperlink"), WindowType::CONTROL }, - { std::u16string_view(u"fixedimage"), WindowType::FIXEDIMAGE }, - { std::u16string_view(u"fixedline"), WindowType::FIXEDLINE }, - { std::u16string_view(u"fixedtext"), WindowType::FIXEDTEXT }, - { std::u16string_view(u"floatingwindow"), WindowType::FLOATINGWINDOW }, - { std::u16string_view(u"formattedfield"), WindowType::CONTROL }, - { std::u16string_view(u"frame"), WindowType::GROUPBOX }, - { std::u16string_view(u"framewindow"), WindowType::TOOLKIT_FRAMEWINDOW }, - { std::u16string_view(u"grid"), WindowType::CONTROL }, - { std::u16string_view(u"groupbox"), WindowType::GROUPBOX }, - { std::u16string_view(u"helpbutton"), WindowType::HELPBUTTON }, - { std::u16string_view(u"imagebutton"), WindowType::IMAGEBUTTON }, - { std::u16string_view(u"infobox"), WindowType::INFOBOX }, - { std::u16string_view(u"listbox"), WindowType::LISTBOX }, - { std::u16string_view(u"longcurrencybox"), WindowType::LONGCURRENCYBOX }, - { std::u16string_view(u"longcurrencyfield"), WindowType::CONTROL }, - { std::u16string_view(u"menubutton"), WindowType::MENUBUTTON }, - { std::u16string_view(u"messbox"), WindowType::MESSBOX }, - { std::u16string_view(u"metricbox"), WindowType::METRICBOX }, - { std::u16string_view(u"metricfield"), WindowType::METRICFIELD }, - { std::u16string_view(u"modelessdialog"), WindowType::MODELESSDIALOG }, - { std::u16string_view(u"morebutton"), WindowType::MOREBUTTON }, - { std::u16string_view(u"multilineedit"), WindowType::MULTILINEEDIT }, - { std::u16string_view(u"multilistbox"), WindowType::MULTILISTBOX }, - { std::u16string_view(u"numericbox"), WindowType::NUMERICBOX }, - { std::u16string_view(u"numericfield"), WindowType::CONTROL }, - { std::u16string_view(u"okbutton"), WindowType::OKBUTTON }, - { std::u16string_view(u"patternbox"), WindowType::PATTERNBOX }, - { std::u16string_view(u"patternfield"), WindowType::PATTERNFIELD }, - { std::u16string_view(u"progressbar"), WindowType::CONTROL }, - { std::u16string_view(u"pushbutton"), WindowType::PUSHBUTTON }, - { std::u16string_view(u"querybox"), WindowType::QUERYBOX }, - { std::u16string_view(u"radiobutton"), WindowType::RADIOBUTTON }, - { std::u16string_view(u"roadmap"), WindowType::CONTROL }, - { std::u16string_view(u"scrollbar"), WindowType::SCROLLBAR }, - { std::u16string_view(u"scrollbarbox"), WindowType::SCROLLBARBOX }, - { std::u16string_view(u"spinbutton"), WindowType::SPINBUTTON }, - { std::u16string_view(u"spinfield"), WindowType::SPINFIELD }, - { std::u16string_view(u"splitter"), WindowType::SPLITTER }, - { std::u16string_view(u"splitwindow"), WindowType::SPLITWINDOW }, - { std::u16string_view(u"statusbar"), WindowType::STATUSBAR }, - { std::u16string_view(u"systemchildwindow"), WindowType::TOOLKIT_SYSTEMCHILDWINDOW }, - { std::u16string_view(u"tabcontrol"), WindowType::TABCONTROL }, - { std::u16string_view(u"tabdialog"), WindowType::TABDIALOG }, - { std::u16string_view(u"tabpage"), WindowType::TABPAGE }, - { std::u16string_view(u"tabpagecontainer"), WindowType::CONTROL }, - { std::u16string_view(u"tabpagemodel"), WindowType::TABPAGE }, - { std::u16string_view(u"timebox"), WindowType::TIMEBOX }, - { std::u16string_view(u"timefield"), WindowType::TIMEFIELD }, - { std::u16string_view(u"toolbox"), WindowType::TOOLBOX }, - { std::u16string_view(u"tree"), WindowType::CONTROL }, - { std::u16string_view(u"tristatebox"), WindowType::TRISTATEBOX }, - { std::u16string_view(u"warningbox"), WindowType::WARNINGBOX }, - { std::u16string_view(u"window"), WindowType::WINDOW }, - { std::u16string_view(u"workwindow"), WindowType::WORKWINDOW } +ComponentInfo const aComponentInfos[] = +{ + { u"animatedimages", WindowType::CONTROL }, + { u"buttondialog", WindowType::BUTTONDIALOG }, + { u"cancelbutton", WindowType::CANCELBUTTON }, + { u"checkbox", WindowType::CHECKBOX }, + { u"combobox", WindowType::COMBOBOX }, + { u"control", WindowType::CONTROL }, + { u"currencybox", WindowType::CURRENCYBOX }, + { u"currencyfield", WindowType::CURRENCYFIELD }, + { u"datebox", WindowType::DATEBOX }, + { u"datefield", WindowType::CONTROL }, + { u"dialog", WindowType::DIALOG }, + { u"dockingarea", WindowType::DOCKINGAREA }, + { u"dockingwindow", WindowType::DOCKINGWINDOW }, + { u"edit", WindowType::EDIT }, + { u"errorbox", WindowType::ERRORBOX }, + { u"filecontrol", WindowType::CONTROL }, + { u"fixedbitmap", WindowType::FIXEDBITMAP }, + { u"fixedhyperlink", WindowType::CONTROL }, + { u"fixedimage", WindowType::FIXEDIMAGE }, + { u"fixedline", WindowType::FIXEDLINE }, + { u"fixedtext", WindowType::FIXEDTEXT }, + { u"floatingwindow", WindowType::FLOATINGWINDOW }, + { u"formattedfield", WindowType::CONTROL }, + { u"frame", WindowType::GROUPBOX }, + { u"framewindow", WindowType::TOOLKIT_FRAMEWINDOW }, + { u"grid", WindowType::CONTROL }, + { u"groupbox", WindowType::GROUPBOX }, + { u"helpbutton", WindowType::HELPBUTTON }, + { u"imagebutton", WindowType::IMAGEBUTTON }, + { u"infobox", WindowType::INFOBOX }, + { u"listbox", WindowType::LISTBOX }, + { u"longcurrencybox", WindowType::LONGCURRENCYBOX }, + { u"longcurrencyfield", WindowType::CONTROL }, + { u"menubutton", WindowType::MENUBUTTON }, + { u"messbox", WindowType::MESSBOX }, + { u"metricbox", WindowType::METRICBOX }, + { u"metricfield", WindowType::METRICFIELD }, + { u"modelessdialog", WindowType::MODELESSDIALOG }, + { u"morebutton", WindowType::MOREBUTTON }, + { u"multilineedit", WindowType::MULTILINEEDIT }, + { u"multilistbox", WindowType::MULTILISTBOX }, + { u"numericbox", WindowType::NUMERICBOX }, + { u"numericfield", WindowType::CONTROL }, + { u"okbutton", WindowType::OKBUTTON }, + { u"patternbox", WindowType::PATTERNBOX }, + { u"patternfield", WindowType::PATTERNFIELD }, + { u"progressbar", WindowType::CONTROL }, + { u"pushbutton", WindowType::PUSHBUTTON }, + { u"querybox", WindowType::QUERYBOX }, + { u"radiobutton", WindowType::RADIOBUTTON }, + { u"roadmap", WindowType::CONTROL }, + { u"scrollbar", WindowType::SCROLLBAR }, + { u"scrollbarbox", WindowType::SCROLLBARBOX }, + { u"spinbutton", WindowType::SPINBUTTON }, + { u"spinfield", WindowType::SPINFIELD }, + { u"splitter", WindowType::SPLITTER }, + { u"splitwindow", WindowType::SPLITWINDOW }, + { u"statusbar", WindowType::STATUSBAR }, + { u"systemchildwindow", WindowType::TOOLKIT_SYSTEMCHILDWINDOW }, + { u"tabcontrol", WindowType::TABCONTROL }, + { u"tabdialog", WindowType::TABDIALOG }, + { u"tabpage", WindowType::TABPAGE }, + { u"tabpagecontainer", WindowType::CONTROL }, + { u"tabpagemodel", WindowType::TABPAGE }, + { u"timebox", WindowType::TIMEBOX }, + { u"timefield", WindowType::TIMEFIELD }, + { u"toolbox", WindowType::TOOLBOX }, + { u"tree", WindowType::CONTROL }, + { u"tristatebox", WindowType::TRISTATEBOX }, + { u"warningbox", WindowType::WARNINGBOX }, + { u"window", WindowType::WINDOW }, + { u"workwindow", WindowType::WORKWINDOW } }; bool ComponentInfoFindCompare( const ComponentInfo & lhs, const OUString & s) commit b5ac0615c6274f706303dcf9854cc2a6f6b15e91 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Aug 8 10:03:57 2025 +0200 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sat Aug 9 09:20:44 2025 +0200 vcl: Add Window::GetTypeName to expose type to name conversion Many times it is useful when to log the window type name instead of only the number of the type enum (i.e. when you check the list of parent windows). This change adds a new method that exposes the type to type name conversion that is already present in the code for the Window. Change-Id: Ice97f7ad27988d99f0e45051e0d8e44befe955e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189162 Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> Tested-by: Jenkins diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 0e378b225b2e..9c3fc6f569d9 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -770,6 +770,7 @@ public: WindowExtendedStyle GetExtendedStyle() const; void SetType( WindowType eType ); WindowType GetType() const; + std::string_view GetTypeName() const; bool IsSystemWindow() const; SAL_DLLPRIVATE bool IsDockingWindow() const; bool IsDialog() const; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index e2cea4f78891..ec2aaa4ee657 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3351,13 +3351,17 @@ std::string_view windowTypeName(WindowType nWindowType) } +std::string_view Window::GetTypeName() const +{ + return windowTypeName(GetType()); +} void Window::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) { if (!mpWindowImpl) return; rJsonWriter.put("id", get_id()); // TODO could be missing - sort out - rJsonWriter.put("type", windowTypeName(GetType())); + rJsonWriter.put("type", GetTypeName()); rJsonWriter.put("text", GetText()); rJsonWriter.put("enabled", IsEnabled()); if (!IsVisible())