diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-02 01:18:42 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-02 18:46:47 +0200 |
commit | 116b9d6ddf2b61186b29f0370234eec9c1bbe306 (patch) | |
tree | 7f90a12333274086e33c4e0fabfd96a8e54e6b6c /vcl/unx | |
parent | d7ba78e9c7be835a1e2ecdacd25995663e96862f (diff) |
Avoid conversions between OUString and OString in VCL
Standardize on OUString, which is the main internal string class.
Convert from/to OUString only when communicating with respective
external APIs.
Removes about 200 conversions from the code.
Change-Id: I96ecee7c6fd271bb76639220e96d69d2964bed26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149930
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/print/prtsetup.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/print/prtsetup.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtkdata.cxx | 36 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 479 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtksalmenu.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk4/convert3to4.cxx | 4 |
6 files changed, 263 insertions, 264 deletions
diff --git a/vcl/unx/generic/print/prtsetup.cxx b/vcl/unx/generic/print/prtsetup.cxx index a13133d6017b..90ae49ec5179 100644 --- a/vcl/unx/generic/print/prtsetup.cxx +++ b/vcl/unx/generic/print/prtsetup.cxx @@ -90,7 +90,7 @@ RTSDialog::~RTSDialog() { } -IMPL_LINK(RTSDialog, ActivatePage, const OString&, rPage, void) +IMPL_LINK(RTSDialog, ActivatePage, const OUString&, rPage, void) { if (rPage == "paper") m_xPaperPage->update(); diff --git a/vcl/unx/generic/print/prtsetup.hxx b/vcl/unx/generic/print/prtsetup.hxx index bcf86670d0b6..04b89d54e075 100644 --- a/vcl/unx/generic/print/prtsetup.hxx +++ b/vcl/unx/generic/print/prtsetup.hxx @@ -45,7 +45,7 @@ class RTSDialog : public weld::GenericDialogController std::unique_ptr<RTSPaperPage> m_xPaperPage; std::unique_ptr<RTSDevicePage> m_xDevicePage; - DECL_LINK(ActivatePage, const OString&, void); + DECL_LINK(ActivatePage, const OUString&, void); DECL_LINK(ClickButton, weld::Button&, void); // helper functions diff --git a/vcl/unx/gtk3/gtkdata.cxx b/vcl/unx/gtk3/gtkdata.cxx index cc8535ff2ad2..f595369f8b53 100644 --- a/vcl/unx/gtk3/gtkdata.cxx +++ b/vcl/unx/gtk3/gtkdata.cxx @@ -888,37 +888,37 @@ namespace { struct ButtonOrder { - std::string_view m_aType; + std::u16string_view m_aType; int m_nPriority; }; } -int getButtonPriority(std::string_view rType) +int getButtonPriority(std::u16string_view rType) { static const size_t N_TYPES = 8; static const ButtonOrder aDiscardCancelSave[N_TYPES] = { - { "discard", 0 }, - { "cancel", 1 }, - { "close", 1 }, - { "no", 2 }, - { "open", 3 }, - { "save", 3 }, - { "yes", 3 }, - { "ok", 3 } + { u"discard", 0 }, + { u"cancel", 1 }, + { u"close", 1 }, + { u"no", 2 }, + { u"open", 3 }, + { u"save", 3 }, + { u"yes", 3 }, + { u"ok", 3 } }; static const ButtonOrder aSaveDiscardCancel[N_TYPES] = { - { "open", 0 }, - { "save", 0 }, - { "yes", 0 }, - { "ok", 0 }, - { "discard", 1 }, - { "no", 1 }, - { "cancel", 2 }, - { "close", 2 } + { u"open", 0 }, + { u"save", 0 }, + { u"yes", 0 }, + { u"ok", 0 }, + { u"discard", 1 }, + { u"no", 1 }, + { u"cancel", 2 }, + { u"close", 2 } }; const ButtonOrder* pOrder = &aDiscardCancelSave[0]; diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 6369aec3b1a3..30ff8681f630 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -2174,17 +2174,17 @@ namespace class GtkInstanceBuilder; - void set_help_id(const GtkWidget *pWidget, const OString& rHelpId) + void set_help_id(const GtkWidget *pWidget, std::u16string_view rHelpId) { - gchar *helpid = g_strdup(rHelpId.getStr()); + gchar *helpid = g_strdup(OUStringToOString(rHelpId, RTL_TEXTENCODING_UTF8).getStr()); g_object_set_data_full(G_OBJECT(pWidget), "g-lo-helpid", helpid, g_free); } - OString get_help_id(const GtkWidget *pWidget) + OUString get_help_id(const GtkWidget *pWidget) { void* pData = g_object_get_data(G_OBJECT(pWidget), "g-lo-helpid"); const gchar* pStr = static_cast<const gchar*>(pData); - return OString(pStr, pStr ? strlen(pStr) : 0); + return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); } KeyEvent CreateKeyEvent(guint keyval, guint16 hardware_keycode, guint state, guint8 group) @@ -2522,23 +2522,23 @@ vcl::Font get_font(GtkWidget* pWidget) } -OString get_buildable_id(GtkBuildable* pWidget) +OUString get_buildable_id(GtkBuildable* pWidget) { #if GTK_CHECK_VERSION(4, 0, 0) const gchar* pStr = gtk_buildable_get_buildable_id(pWidget); #else const gchar* pStr = gtk_buildable_get_name(pWidget); #endif - return OString(pStr, pStr ? strlen(pStr) : 0); + return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); } -void set_buildable_id(GtkBuildable* pWidget, const OString& rId) +void set_buildable_id(GtkBuildable* pWidget, const OUString& rId) { #if GTK_CHECK_VERSION(4, 0, 0) GtkBuildableIface *iface = GTK_BUILDABLE_GET_IFACE(pWidget); - (*iface->set_id)(pWidget, rId.getStr()); + (*iface->set_id)(pWidget, OUStringToOString(rId, RTL_TEXTENCODING_UTF8).getStr()); #else - gtk_buildable_set_name(pWidget, rId.getStr()); + gtk_buildable_set_name(pWidget, OUStringToOString(rId, RTL_TEXTENCODING_UTF8).getStr()); #endif } @@ -3929,26 +3929,26 @@ public: virtual std::unique_ptr<weld::Container> weld_parent() const override; - virtual OString get_buildable_name() const override + virtual OUString get_buildable_name() const override { return ::get_buildable_id(GTK_BUILDABLE(m_pWidget)); } - virtual void set_buildable_name(const OString& rId) override + virtual void set_buildable_name(const OUString& rId) override { ::set_buildable_id(GTK_BUILDABLE(m_pWidget), rId); } - virtual void set_help_id(const OString& rHelpId) override + virtual void set_help_id(const OUString& rHelpId) override { ::set_help_id(m_pWidget, rHelpId); } - virtual OString get_help_id() const override + virtual OUString get_help_id() const override { - OString sRet = ::get_help_id(m_pWidget); + OUString sRet = ::get_help_id(m_pWidget); if (sRet.isEmpty()) - sRet = OString("null"); + sRet = "null"; return sRet; } @@ -4426,7 +4426,7 @@ public: } } - virtual void help_hierarchy_foreach(const std::function<bool(const OString&)>& func) override; + virtual void help_hierarchy_foreach(const std::function<bool(const OUString&)>& func) override; virtual OUString strip_mnemonic(const OUString &rLabel) const override { @@ -5232,13 +5232,13 @@ protected: #if !GTK_CHECK_VERSION(4, 0, 0) GtkMenu* m_pMenu; - std::map<OString, GtkMenuItem*> m_aMap; + std::map<OUString, GtkMenuItem*> m_aMap; #else GtkPopoverMenu* m_pMenu; o3tl::sorted_vector<OString> m_aInsertedActions; // must outlive m_aActionEntries - std::map<OString, OString> m_aIdToAction; - std::set<OString> m_aHiddenIds; + std::map<OUString, OString> m_aIdToAction; + std::set<OUString> m_aHiddenIds; std::vector<GActionEntry> m_aActionEntries; GActionGroup* m_pActionGroup; // move 'invisible' entries to m_pHiddenActionGroup @@ -5247,7 +5247,7 @@ protected: bool m_bTakeOwnership; private: - virtual void signal_item_activate(const OString& rIdent) = 0; + virtual void signal_item_activate(const OUString& rIdent) = 0; #if !GTK_CHECK_VERSION(4, 0, 0) static void collect(GtkWidget* pItem, gpointer widget) @@ -5266,15 +5266,15 @@ private: pThis->signal_item_activate(::get_buildable_id(GTK_BUILDABLE(pItem))); } #else - static std::pair<GMenuModel*, int> find_id(GMenuModel* pMenuModel, const OString& rId) + static std::pair<GMenuModel*, int> find_id(GMenuModel* pMenuModel, const OUString& rId) { for (int i = 0, nCount = g_menu_model_get_n_items(pMenuModel); i < nCount; ++i) { - OString sTarget; + OUString sTarget; char *id; if (g_menu_model_get_item_attribute(pMenuModel, i, "target", "s", &id)) { - sTarget = OString(id); + sTarget = OStringToOUString(id, RTL_TEXTENCODING_UTF8); g_free(id); } @@ -5314,7 +5314,7 @@ private: { gsize nLength(0); const gchar* pStr = g_variant_get_string(pParameter, &nLength); - OString aStr(pStr, nLength); + OUString aStr(pStr, nLength, RTL_TEXTENCODING_UTF8); MenuHelper* pThis = static_cast<MenuHelper*>(widget); SolarMutexGuard aGuard; pThis->signal_item_activate(aStr); @@ -5343,14 +5343,14 @@ public: #if !GTK_CHECK_VERSION(4, 0, 0) void add_to_map(GtkMenuItem* pMenuItem) { - OString id = ::get_buildable_id(GTK_BUILDABLE(pMenuItem)); + OUString id = ::get_buildable_id(GTK_BUILDABLE(pMenuItem)); m_aMap[id] = pMenuItem; g_signal_connect(pMenuItem, "activate", G_CALLBACK(signalActivate), this); } void remove_from_map(GtkMenuItem* pMenuItem) { - OString id = ::get_buildable_id(GTK_BUILDABLE(pMenuItem)); + OUString id = ::get_buildable_id(GTK_BUILDABLE(pMenuItem)); auto iter = m_aMap.find(id); g_signal_handlers_disconnect_by_data(pMenuItem, this); m_aMap.erase(iter); @@ -5427,7 +5427,8 @@ public: { for (int i = 0, nCount = g_menu_model_get_n_items(pMenuModel); i < nCount; ++i) { - OString sAction, sTarget; + OString sAction; + OUString sTarget; char *id; if (g_menu_model_get_item_attribute(pMenuModel, i, "action", "s", &id)) { @@ -5451,7 +5452,7 @@ public: if (g_menu_model_get_item_attribute(pMenuModel, i, "target", "s", &id)) { - sTarget = OString(id); + sTarget = OStringToOUString(id, RTL_TEXTENCODING_UTF8); g_free(id); } @@ -5517,7 +5518,7 @@ public: if (eCheckRadioFalse == TRISTATE_FALSE) gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(pItem), true); - ::set_buildable_id(GTK_BUILDABLE(pItem), OUStringToOString(rId, RTL_TEXTENCODING_UTF8)); + ::set_buildable_id(GTK_BUILDABLE(pItem), rId); gtk_menu_shell_append(GTK_MENU_SHELL(m_pMenu), pItem); gtk_widget_show(pItem); add_to_map(GTK_MENU_ITEM(pItem)); @@ -5551,7 +5552,7 @@ public: { #if !GTK_CHECK_VERSION(4, 0, 0) GtkWidget* pItem = gtk_separator_menu_item_new(); - ::set_buildable_id(GTK_BUILDABLE(pItem), OUStringToOString(rId, RTL_TEXTENCODING_UTF8)); + ::set_buildable_id(GTK_BUILDABLE(pItem), rId); gtk_menu_shell_append(GTK_MENU_SHELL(m_pMenu), pItem); gtk_widget_show(pItem); add_to_map(GTK_MENU_ITEM(pItem)); @@ -5590,7 +5591,7 @@ public: #endif } - void remove_item(const OString& rIdent) + void remove_item(const OUString& rIdent) { #if !GTK_CHECK_VERSION(4, 0, 0) GtkMenuItem* pMenuItem = m_aMap[rIdent]; @@ -5607,7 +5608,7 @@ public: #endif } - void set_item_sensitive(const OString& rIdent, bool bSensitive) + void set_item_sensitive(const OUString& rIdent, bool bSensitive) { #if GTK_CHECK_VERSION(4, 0, 0) GActionGroup* pActionGroup = m_aHiddenIds.find(rIdent) == m_aHiddenIds.end() ? m_pActionGroup : m_pHiddenActionGroup; @@ -5618,7 +5619,7 @@ public: #endif } - bool get_item_sensitive(const OString& rIdent) const + bool get_item_sensitive(const OUString& rIdent) const { #if GTK_CHECK_VERSION(4, 0, 0) GActionGroup* pActionGroup = m_aHiddenIds.find(rIdent) == m_aHiddenIds.end() ? m_pActionGroup : m_pHiddenActionGroup; @@ -5629,7 +5630,7 @@ public: #endif } - void set_item_active(const OString& rIdent, bool bActive) + void set_item_active(const OUString& rIdent, bool bActive) { #if !GTK_CHECK_VERSION(4, 0, 0) disable_item_notify_events(); @@ -5638,11 +5639,11 @@ public: #else GActionGroup* pActionGroup = m_aHiddenIds.find(rIdent) == m_aHiddenIds.end() ? m_pActionGroup : m_pHiddenActionGroup; g_action_group_change_action_state(pActionGroup, m_aIdToAction[rIdent].getStr(), - g_variant_new_string(bActive ? rIdent.getStr() : "'none'")); + g_variant_new_string(bActive ? OUStringToOString(rIdent, RTL_TEXTENCODING_UTF8).getStr() : "'none'")); #endif } - bool get_item_active(const OString& rIdent) const + bool get_item_active(const OUString& rIdent) const { #if !GTK_CHECK_VERSION(4, 0, 0) return gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(m_aMap.find(rIdent)->second)); @@ -5658,7 +5659,7 @@ public: #endif } - void set_item_label(const OString& rIdent, const OUString& rText) + void set_item_label(const OUString& rIdent, const OUString& rText) { #if !GTK_CHECK_VERSION(4, 0, 0) gtk_menu_item_set_label(m_aMap[rIdent], MapToGtkAccelerator(rText).getStr()); @@ -5679,7 +5680,7 @@ public: #endif } - OUString get_item_label(const OString& rIdent) const + OUString get_item_label(const OUString& rIdent) const { #if !GTK_CHECK_VERSION(4, 0, 0) const gchar* pText = gtk_menu_item_get_label(m_aMap.find(rIdent)->second); @@ -5704,7 +5705,7 @@ public: #endif } - void set_item_visible(const OString& rIdent, bool bShow) + void set_item_visible(const OUString& rIdent, bool bShow) { #if !GTK_CHECK_VERSION(4, 0, 0) GtkWidget* pWidget = GTK_WIDGET(m_aMap[rIdent]); @@ -5734,23 +5735,23 @@ public: #endif } - OString get_item_id(int pos) const + OUString get_item_id(int pos) const { #if !GTK_CHECK_VERSION(4, 0, 0) GList* pChildren = gtk_container_get_children(GTK_CONTAINER(m_pMenu)); gpointer pMenuItem = g_list_nth_data(pChildren, pos); - OString id = ::get_buildable_id(GTK_BUILDABLE(pMenuItem)); + OUString id = ::get_buildable_id(GTK_BUILDABLE(pMenuItem)); g_list_free(pChildren); return id; #else - OString sTarget; + OUString sTarget; if (GMenuModel* pMenuModel = m_pMenu ? gtk_popover_menu_get_menu_model(m_pMenu) : nullptr) { auto aSectionAndPos = get_section_and_pos_for(pMenuModel, pos); char *id; if (g_menu_model_get_item_attribute(aSectionAndPos.first, aSectionAndPos.second, "target", "s", &id)) { - sTarget = OString(id); + sTarget = OStringToOUString(id, RTL_TEXTENCODING_UTF8); g_free(id); } } @@ -6468,7 +6469,7 @@ public: #endif } - virtual void set_window_state(const OString& rStr) override + virtual void set_window_state(const OUString& rStr) override { const vcl::WindowData aData(rStr); const auto nMask = aData.mask(); @@ -6494,7 +6495,7 @@ public: #endif } - virtual OString get_window_state(vcl::WindowDataMask nMask) const override + virtual OUString get_window_state(vcl::WindowDataMask nMask) const override { bool bPositioningAllowed = isPositioningAllowed(); @@ -7142,7 +7143,7 @@ public: virtual void response(int nResponse) override; - virtual void add_button(const OUString& rText, int nResponse, const OString& rHelpId) override + virtual void add_button(const OUString& rText, int nResponse, const OUString& rHelpId) override { GtkWidget* pWidget = gtk_dialog_add_button(GTK_DIALOG(m_pDialog), MapToGtkAccelerator(rText).getStr(), VclToGtk(nResponse)); if (!rHelpId.isEmpty()) @@ -7386,15 +7387,15 @@ private: GtkButton* m_pCancel; gulong m_nButtonPressSignalId; std::vector<std::unique_ptr<GtkInstanceContainer>> m_aPages; - std::map<OString, bool> m_aNotClickable; + std::map<OUString, bool> m_aNotClickable; - int find_page(std::string_view ident) const + int find_page(std::u16string_view ident) const { int nPages = gtk_assistant_get_n_pages(m_pAssistant); for (int i = 0; i < nPages; ++i) { GtkWidget* pPage = gtk_assistant_get_nth_page(m_pAssistant, i); - OString sBuildableName = ::get_buildable_id(GTK_BUILDABLE(pPage)); + OUString sBuildableName = ::get_buildable_id(GTK_BUILDABLE(pPage)); if (sBuildableName == ident) return i; } @@ -7413,7 +7414,7 @@ private: static void find_sidebar(GtkWidget *pWidget, gpointer user_data) { - OString sBuildableName = ::get_buildable_id(GTK_BUILDABLE(pWidget)); + OUString sBuildableName = ::get_buildable_id(GTK_BUILDABLE(pWidget)); if (sBuildableName == "sidebar") { GtkWidget **ppSidebar = static_cast<GtkWidget**>(user_data); @@ -7506,7 +7507,7 @@ private: if (nNewCurrentPage != -1 && nNewCurrentPage != get_current_page()) { - OString sIdent = get_page_ident(nNewCurrentPage); + OUString sIdent = get_page_ident(nNewCurrentPage); if (!m_aNotClickable[sIdent] && !signal_jump_page(sIdent)) set_current_page(nNewCurrentPage); } @@ -7655,13 +7656,13 @@ public: return gtk_assistant_get_n_pages(m_pAssistant); } - virtual OString get_page_ident(int nPage) const override + virtual OUString get_page_ident(int nPage) const override { const GtkWidget* pWidget = gtk_assistant_get_nth_page(m_pAssistant, nPage); return ::get_buildable_id(GTK_BUILDABLE(pWidget)); } - virtual OString get_current_page_ident() const override + virtual OUString get_current_page_ident() const override { return get_page_ident(get_current_page()); } @@ -7679,7 +7680,7 @@ public: gtk_window_set_title(GTK_WINDOW(m_pAssistant), sDialogTitle.getStr()); } - virtual void set_current_page(const OString& rIdent) override + virtual void set_current_page(const OUString& rIdent) override { int nPage = find_page(rIdent); if (nPage == -1) @@ -7687,7 +7688,7 @@ public: set_current_page(nPage); } - virtual void set_page_title(const OString& rIdent, const OUString& rTitle) override + virtual void set_page_title(const OUString& rIdent, const OUString& rTitle) override { int nIndex = find_page(rIdent); if (nIndex == -1) @@ -7700,7 +7701,7 @@ public: #endif } - virtual OUString get_page_title(const OString& rIdent) const override + virtual OUString get_page_title(const OUString& rIdent) const override { int nIndex = find_page(rIdent); if (nIndex == -1) @@ -7710,12 +7711,12 @@ public: return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); } - virtual void set_page_sensitive(const OString& rIdent, bool bSensitive) override + virtual void set_page_sensitive(const OUString& rIdent, bool bSensitive) override { m_aNotClickable[rIdent] = !bSensitive; } - virtual void set_page_index(const OString& rIdent, int nNewIndex) override + virtual void set_page_index(const OUString& rIdent, int nNewIndex) override { int nOldIndex = find_page(rIdent); if (nOldIndex == -1) @@ -7741,7 +7742,7 @@ public: g_object_unref(pPage); } - virtual weld::Container* append_page(const OString& rIdent) override + virtual weld::Container* append_page(const OUString& rIdent) override { disable_notify_events(); @@ -7762,7 +7763,7 @@ public: return m_aPages.back().get(); } - virtual void set_page_side_help_id(const OString& rHelpId) override + virtual void set_page_side_help_id(const OUString& rHelpId) override { if (!m_pSidebar) return; @@ -8814,7 +8815,7 @@ private: } if (m_bOverFlowBoxActive) gtk_notebook_set_current_page(m_pOverFlowNotebook, gtk_notebook_get_n_pages(m_pOverFlowNotebook) - 1); - OString sNewIdent(get_page_ident(nNewPage)); + OUString sNewIdent(get_page_ident(nNewPage)); if (!m_bInternalPageChange) m_aEnterPageHdl.Call(sNewIdent); } @@ -8831,7 +8832,7 @@ private: int i = nMainPages; while (nOverFlowPages) { - OString sIdent(get_page_ident(m_pOverFlowNotebook, 0)); + OUString sIdent(get_page_ident(m_pOverFlowNotebook, 0)); OUString sLabel(get_tab_label_text(m_pOverFlowNotebook, 0)); remove_page(m_pOverFlowNotebook, sIdent); @@ -8847,7 +8848,7 @@ private: } // remove the dangling placeholder tab page - remove_page(m_pOverFlowNotebook, "useless"); + remove_page(m_pOverFlowNotebook, u"useless"); } // a tab has been selected on the overflow notebook @@ -8881,30 +8882,30 @@ private: enable_notify_events(); // trigger main notebook switch-page callback - OString sNewIdent(get_page_ident(m_pNotebook, nNewPage)); + OUString sNewIdent(get_page_ident(m_pNotebook, nNewPage)); m_aEnterPageHdl.Call(sNewIdent); } - static OString get_page_ident(GtkNotebook *pNotebook, guint nPage) + static OUString get_page_ident(GtkNotebook *pNotebook, guint nPage) { const GtkWidget* pTabWidget = gtk_notebook_get_tab_label(pNotebook, gtk_notebook_get_nth_page(pNotebook, nPage)); return ::get_buildable_id(GTK_BUILDABLE(pTabWidget)); } - static gint get_page_number(GtkNotebook *pNotebook, std::string_view ident) + static gint get_page_number(GtkNotebook *pNotebook, std::u16string_view ident) { gint nPages = gtk_notebook_get_n_pages(pNotebook); for (gint i = 0; i < nPages; ++i) { const GtkWidget* pTabWidget = gtk_notebook_get_tab_label(pNotebook, gtk_notebook_get_nth_page(pNotebook, i)); - OString sBuildableName = ::get_buildable_id(GTK_BUILDABLE(pTabWidget)); + OUString sBuildableName = ::get_buildable_id(GTK_BUILDABLE(pTabWidget)); if (sBuildableName == ident) return i; } return -1; } - int remove_page(GtkNotebook *pNotebook, std::string_view ident) + int remove_page(GtkNotebook *pNotebook, std::u16string_view ident) { disable_notify_events(); int nPageNumber = get_page_number(pNotebook, ident); @@ -8954,7 +8955,7 @@ private: enable_notify_events(); } - void insert_page(GtkNotebook *pNotebook, const OString& rIdent, const OUString& rLabel, GtkWidget *pChild, int nPos) + void insert_page(GtkNotebook *pNotebook, const OUString& rIdent, const OUString& rLabel, GtkWidget *pChild, int nPos) { disable_notify_events(); @@ -9058,7 +9059,7 @@ private: int nOverFlowPages = m_nStartTabCount; while (nOverFlowPages) { - OString sIdent(get_page_ident(m_pNotebook, 0)); + OUString sIdent(get_page_ident(m_pNotebook, 0)); OUString sLabel(get_tab_label_text(m_pNotebook, 0)); remove_page(m_pNotebook, sIdent); insert_page(m_pOverFlowNotebook, sIdent, sLabel, gtk_grid_new(), -1); @@ -9095,7 +9096,7 @@ private: gtk_widget_set_size_request(GTK_WIDGET(m_pOverFlowNotebook), nWidth, -1); // remove it once we've measured it - remove_page(m_pNotebook, "useless"); + remove_page(m_pNotebook, u"useless"); #if !GTK_CHECK_VERSION(4, 0, 0) gtk_widget_thaw_child_notify(GTK_WIDGET(m_pOverFlowNotebook)); @@ -9266,7 +9267,7 @@ public: return nPage; } - virtual OString get_page_ident(int nPage) const override + virtual OUString get_page_ident(int nPage) const override { auto nMainLen = gtk_notebook_get_n_pages(m_pNotebook); auto nOverFlowLen = m_bOverFlowBoxActive ? gtk_notebook_get_n_pages(m_pOverFlowNotebook) - 1 : 0; @@ -9286,13 +9287,13 @@ public: } } - virtual OString get_current_page_ident() const override + virtual OUString get_current_page_ident() const override { const int nPage = get_current_page(); - return nPage != -1 ? get_page_ident(nPage) : OString(); + return nPage != -1 ? get_page_ident(nPage) : OUString(); } - virtual int get_page_index(const OString& rIdent) const override + virtual int get_page_index(const OUString& rIdent) const override { auto nMainIndex = get_page_number(m_pNotebook, rIdent); auto nOverFlowIndex = get_page_number(m_pOverFlowNotebook, rIdent); @@ -9322,7 +9323,7 @@ public: } } - virtual weld::Container* get_page(const OString& rIdent) const override + virtual weld::Container* get_page(const OUString& rIdent) const override { int nPage = get_page_index(rIdent); if (nPage < 0) @@ -9400,7 +9401,7 @@ public: m_bInternalPageChange = bInternalPageChange; } - virtual void set_current_page(const OString& rIdent) override + virtual void set_current_page(const OUString& rIdent) override { gint nPage = get_page_index(rIdent); set_current_page(nPage); @@ -9414,7 +9415,7 @@ public: return nLen; } - virtual OUString get_tab_label_text(const OString& rIdent) const override + virtual OUString get_tab_label_text(const OUString& rIdent) const override { gint nPageNum = get_page_number(m_pNotebook, rIdent); if (nPageNum != -1) @@ -9425,7 +9426,7 @@ public: return OUString(); } - virtual void set_tab_label_text(const OString& rIdent, const OUString& rText) override + virtual void set_tab_label_text(const OUString& rIdent, const OUString& rText) override { gint nPageNum = get_page_number(m_pNotebook, rIdent); if (nPageNum != -1) @@ -9491,7 +9492,7 @@ public: m_nEndTabCount = 0; } - virtual void remove_page(const OString& rIdent) override + virtual void remove_page(const OUString& rIdent) override { if (m_bOverFlowBoxActive) { @@ -9504,7 +9505,7 @@ public: m_aPages.erase(m_aPages.begin() + nPageIndex); } - virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override + virtual void insert_page(const OUString& rIdent, const OUString& rLabel, int nPos) override { if (m_bOverFlowBoxActive) { @@ -10846,7 +10847,7 @@ public: MenuHelper::insert_separator(pos, rId); } - virtual void remove_item(const OString& rId) override + virtual void remove_item(const OUString& rId) override { MenuHelper::remove_item(rId); } @@ -10856,32 +10857,32 @@ public: MenuHelper::clear_items(); } - virtual void set_item_active(const OString& rIdent, bool bActive) override + virtual void set_item_active(const OUString& rIdent, bool bActive) override { MenuHelper::set_item_active(rIdent, bActive); } - virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override + virtual void set_item_sensitive(const OUString& rIdent, bool bSensitive) override { MenuHelper::set_item_sensitive(rIdent, bSensitive); } - virtual void set_item_label(const OString& rIdent, const OUString& rLabel) override + virtual void set_item_label(const OUString& rIdent, const OUString& rLabel) override { MenuHelper::set_item_label(rIdent, rLabel); } - virtual OUString get_item_label(const OString& rIdent) const override + virtual OUString get_item_label(const OUString& rIdent) const override { return MenuHelper::get_item_label(rIdent); } - virtual void set_item_visible(const OString& rIdent, bool bVisible) override + virtual void set_item_visible(const OUString& rIdent, bool bVisible) override { MenuHelper::set_item_visible(rIdent, bVisible); } - virtual void signal_item_activate(const OString& rIdent) override + virtual void signal_item_activate(const OUString& rIdent) override { signal_selected(rIdent); } @@ -11275,7 +11276,7 @@ public: MenuHelper::insert_separator(pos, rId); } - virtual void remove_item(const OString& rId) override + virtual void remove_item(const OUString& rId) override { MenuHelper::remove_item(rId); } @@ -11285,32 +11286,32 @@ public: MenuHelper::clear_items(); } - virtual void set_item_active(const OString& rIdent, bool bActive) override + virtual void set_item_active(const OUString& rIdent, bool bActive) override { MenuHelper::set_item_active(rIdent, bActive); } - virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override + virtual void set_item_sensitive(const OUString& rIdent, bool bSensitive) override { MenuHelper::set_item_sensitive(rIdent, bSensitive); } - virtual void set_item_label(const OString& rIdent, const OUString& rLabel) override + virtual void set_item_label(const OUString& rIdent, const OUString& rLabel) override { MenuHelper::set_item_label(rIdent, rLabel); } - virtual OUString get_item_label(const OString& rIdent) const override + virtual OUString get_item_label(const OUString& rIdent) const override { return MenuHelper::get_item_label(rIdent); } - virtual void set_item_visible(const OString& rIdent, bool bVisible) override + virtual void set_item_visible(const OUString& rIdent, bool bVisible) override { MenuHelper::set_item_visible(rIdent, bVisible); } - virtual void signal_item_activate(const OString& rIdent) override + virtual void signal_item_activate(const OUString& rIdent) override { signal_selected(rIdent); } @@ -11327,13 +11328,13 @@ protected: #if !GTK_CHECK_VERSION(4, 0, 0) std::vector<GtkMenuItem*> m_aExtraItems; #endif - OString m_sActivated; + OUString m_sActivated; #if !GTK_CHECK_VERSION(4, 0, 0) MenuHelper* m_pTopLevelMenuHelper; #endif private: - virtual void signal_item_activate(const OString& rIdent) override + virtual void signal_item_activate(const OUString& rIdent) override { m_sActivated = rIdent; weld::Menu::signal_activate(m_sActivated); @@ -11401,7 +11402,7 @@ public: #endif } - virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect, weld::Placement ePlace) override + virtual OUString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect, weld::Placement ePlace) override { m_sActivated.clear(); @@ -11526,37 +11527,37 @@ public: return m_sActivated; } - virtual void set_sensitive(const OString& rIdent, bool bSensitive) override + virtual void set_sensitive(const OUString& rIdent, bool bSensitive) override { set_item_sensitive(rIdent, bSensitive); } - virtual bool get_sensitive(const OString& rIdent) const override + virtual bool get_sensitive(const OUString& rIdent) const override { return get_item_sensitive(rIdent); } - virtual void set_active(const OString& rIdent, bool bActive) override + virtual void set_active(const OUString& rIdent, bool bActive) override { set_item_active(rIdent, bActive); } - virtual bool get_active(const OString& rIdent) const override + virtual bool get_active(const OUString& rIdent) const override { return get_item_active(rIdent); } - virtual void set_visible(const OString& rIdent, bool bShow) override + virtual void set_visible(const OUString& rIdent, bool bShow) override { set_item_visible(rIdent, bShow); } - virtual void set_label(const OString& rIdent, const OUString& rLabel) override + virtual void set_label(const OUString& rIdent, const OUString& rLabel) override { set_item_label(rIdent, rLabel); } - virtual OUString get_label(const OString& rIdent) const override + virtual OUString get_label(const OUString& rIdent) const override { return get_item_label(rIdent); } @@ -11613,7 +11614,7 @@ public: if (eCheckRadioFalse == TRISTATE_FALSE) gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(pItem), true); - ::set_buildable_id(GTK_BUILDABLE(pItem), OUStringToOString(rId, RTL_TEXTENCODING_UTF8)); + ::set_buildable_id(GTK_BUILDABLE(pItem), rId); gtk_menu_shell_append(GTK_MENU_SHELL(m_pMenu), pItem); gtk_widget_show(pItem); GtkMenuItem* pMenuItem = GTK_MENU_ITEM(pItem); @@ -11651,7 +11652,7 @@ public: #endif } - virtual OString get_id(int pos) const override + virtual OUString get_id(int pos) const override { return get_item_id(pos); } @@ -11661,7 +11662,7 @@ public: return get_n_children(); } - void remove(const OString& rIdent) override + void remove(const OUString& rIdent) override { #if !GTK_CHECK_VERSION(4, 0, 0) if (!m_aExtraItems.empty()) @@ -11819,9 +11820,9 @@ private: #endif GtkCssProvider *m_pMenuButtonProvider; - std::map<OString, GtkWidget*> m_aMap; - std::map<OString, std::unique_ptr<GtkInstanceMenuButton>> m_aMenuButtonMap; - std::map<OString, bool> m_aMirroredMap; + std::map<OUString, GtkWidget*> m_aMap; + std::map<OUString, std::unique_ptr<GtkInstanceMenuButton>> m_aMenuButtonMap; + std::map<OUString, bool> m_aMirroredMap; #if !GTK_CHECK_VERSION(4, 0, 0) // at the time of writing there is no gtk_menu_tool_button_set_popover available @@ -11872,7 +11873,7 @@ private: void add_to_map(GtkWidget* pToolItem, GtkMenuButton* pMenuButton) { - OString id = ::get_buildable_id(GTK_BUILDABLE(pToolItem)); + OUString id = ::get_buildable_id(GTK_BUILDABLE(pToolItem)); m_aMap[id] = pToolItem; if (pMenuButton) { @@ -12089,36 +12090,36 @@ public: } } - virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override + virtual void set_item_sensitive(const OUString& rIdent, bool bSensitive) override { disable_item_notify_events(); gtk_widget_set_sensitive(GTK_WIDGET(m_aMap[rIdent]), bSensitive); enable_item_notify_events(); } - virtual bool get_item_sensitive(const OString& rIdent) const override + virtual bool get_item_sensitive(const OUString& rIdent) const override { return gtk_widget_get_sensitive(GTK_WIDGET(m_aMap.find(rIdent)->second)); } - virtual void set_item_visible(const OString& rIdent, bool bVisible) override + virtual void set_item_visible(const OUString& rIdent, bool bVisible) override { disable_item_notify_events(); gtk_widget_set_visible(GTK_WIDGET(m_aMap[rIdent]), bVisible); enable_item_notify_events(); } - virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) override + virtual void set_item_help_id(const OUString& rIdent, const OUString& rHelpId) override { ::set_help_id(GTK_WIDGET(m_aMap[rIdent]), rHelpId); } - virtual bool get_item_visible(const OString& rIdent) const override + virtual bool get_item_visible(const OUString& rIdent) const override { return gtk_widget_get_visible(GTK_WIDGET(m_aMap.find(rIdent)->second)); } - virtual void set_item_active(const OString& rIdent, bool bActive) override + virtual void set_item_active(const OUString& rIdent, bool bActive) override { disable_item_notify_events(); @@ -12159,7 +12160,7 @@ public: enable_item_notify_events(); } - virtual bool get_item_active(const OString& rIdent) const override + virtual bool get_item_active(const OUString& rIdent) const override { GtkWidget* pToolButton = m_aMap.find(rIdent)->second; @@ -12192,7 +12193,7 @@ public: return false; } - virtual void set_menu_item_active(const OString& rIdent, bool bActive) override + virtual void set_menu_item_active(const OUString& rIdent, bool bActive) override { disable_item_notify_events(); @@ -12203,7 +12204,7 @@ public: enable_item_notify_events(); } - virtual bool get_menu_item_active(const OString& rIdent) const override + virtual bool get_menu_item_active(const OUString& rIdent) const override { auto aFind = m_aMenuButtonMap.find(rIdent); assert (aFind != m_aMenuButtonMap.end()); @@ -12212,13 +12213,12 @@ public: virtual void insert_item(int pos, const OUString& rId) override { - OString sId = OUStringToOString(rId, RTL_TEXTENCODING_UTF8); #if !GTK_CHECK_VERSION(4, 0, 0) - GtkToolItem* pItem = gtk_tool_button_new(nullptr, sId.getStr()); + GtkToolItem* pItem = gtk_tool_button_new(nullptr, OUStringToOString(rId, RTL_TEXTENCODING_UTF8).getStr()); #else GtkWidget* pItem = gtk_button_new(); #endif - ::set_buildable_id(GTK_BUILDABLE(pItem), sId); + ::set_buildable_id(GTK_BUILDABLE(pItem), rId); #if !GTK_CHECK_VERSION(4, 0, 0) gtk_toolbar_insert(m_pToolbar, pItem, pos); #else @@ -12230,13 +12230,12 @@ public: virtual void insert_separator(int pos, const OUString& rId) override { - OString sId = OUStringToOString(rId, RTL_TEXTENCODING_UTF8); #if !GTK_CHECK_VERSION(4, 0, 0) GtkToolItem* pItem = gtk_separator_tool_item_new(); #else GtkWidget* pItem = gtk_separator_new(GTK_ORIENTATION_VERTICAL); #endif - ::set_buildable_id(GTK_BUILDABLE(pItem), sId); + ::set_buildable_id(GTK_BUILDABLE(pItem), rId); #if !GTK_CHECK_VERSION(4, 0, 0) gtk_toolbar_insert(m_pToolbar, pItem, pos); #else @@ -12245,12 +12244,12 @@ public: gtk_widget_show(GTK_WIDGET(pItem)); } - virtual void set_item_popover(const OString& rIdent, weld::Widget* pPopover) override + virtual void set_item_popover(const OUString& rIdent, weld::Widget* pPopover) override { m_aMenuButtonMap[rIdent]->set_popover(pPopover); } - virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) override + virtual void set_item_menu(const OUString& rIdent, weld::Menu* pMenu) override { m_aMenuButtonMap[rIdent]->set_menu(pMenu); } @@ -12270,15 +12269,15 @@ public: #endif } - virtual OString get_item_ident(int nIndex) const override + virtual OUString get_item_ident(int nIndex) const override { auto* pItem = toolbar_get_nth_item(nIndex); return ::get_buildable_id(GTK_BUILDABLE(pItem)); } - virtual void set_item_ident(int nIndex, const OString& rIdent) override + virtual void set_item_ident(int nIndex, const OUString& rIdent) override { - OString sOldIdent(get_item_ident(nIndex)); + OUString sOldIdent(get_item_ident(nIndex)); m_aMap.erase(m_aMap.find(sOldIdent)); auto* pItem = toolbar_get_nth_item(nIndex); @@ -12311,7 +12310,7 @@ public: #endif } - virtual void set_item_label(const OString& rIdent, const OUString& rLabel) override + virtual void set_item_label(const OUString& rIdent, const OUString& rLabel) override { GtkWidget* pItem = m_aMap[rIdent]; #if !GTK_CHECK_VERSION(4, 0, 0) @@ -12325,7 +12324,7 @@ public: #endif } - OUString get_item_label(const OString& rIdent) const override + OUString get_item_label(const OUString& rIdent) const override { #if !GTK_CHECK_VERSION(4, 0, 0) const gchar* pText = gtk_tool_button_get_label(GTK_TOOL_BUTTON(m_aMap.find(rIdent)->second)); @@ -12335,7 +12334,7 @@ public: return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); } - virtual void set_item_icon_name(const OString& rIdent, const OUString& rIconName) override + virtual void set_item_icon_name(const OUString& rIdent, const OUString& rIconName) override { GtkWidget* pItem = m_aMap[rIdent]; #if !GTK_CHECK_VERSION(4, 0, 0) @@ -12359,12 +12358,12 @@ public: #endif } - virtual void set_item_image_mirrored(const OString& rIdent, bool bMirrored) override + virtual void set_item_image_mirrored(const OUString& rIdent, bool bMirrored) override { m_aMirroredMap[rIdent] = bMirrored; } - virtual void set_item_image(const OString& rIdent, const css::uno::Reference<css::graphic::XGraphic>& rIcon) override + virtual void set_item_image(const OUString& rIdent, const css::uno::Reference<css::graphic::XGraphic>& rIcon) override { GtkWidget* pItem = m_aMap[rIdent]; auto it = m_aMirroredMap.find(rIdent); @@ -12380,7 +12379,7 @@ public: #endif } - virtual void set_item_image(const OString& rIdent, VirtualDevice* pDevice) override + virtual void set_item_image(const OUString& rIdent, VirtualDevice* pDevice) override { GtkWidget* pItem = m_aMap[rIdent]; #if !GTK_CHECK_VERSION(4, 0, 0) @@ -12412,13 +12411,13 @@ public: gtk_widget_set_tooltip_text(GTK_WIDGET(pItem), OUStringToOString(rTip, RTL_TEXTENCODING_UTF8).getStr()); } - virtual void set_item_tooltip_text(const OString& rIdent, const OUString& rTip) override + virtual void set_item_tooltip_text(const OUString& rIdent, const OUString& rTip) override { GtkWidget* pItem = GTK_WIDGET(m_aMap[rIdent]); gtk_widget_set_tooltip_text(pItem, OUStringToOString(rTip, RTL_TEXTENCODING_UTF8).getStr()); } - virtual OUString get_item_tooltip_text(const OString& rIdent) const override + virtual OUString get_item_tooltip_text(const OUString& rIdent) const override { GtkWidget* pItem = GTK_WIDGET(m_aMap.find(rIdent)->second); const gchar* pStr = gtk_widget_get_tooltip_text(pItem); @@ -19036,7 +19035,7 @@ public: , m_pComboBox(pComboBox) { } - virtual void signal_item_activate(const OString& /*rIdent*/) override + virtual void signal_item_activate(const OUString& /*rIdent*/) override { gtk_toggle_button_set_active(m_pComboBox, false); } @@ -19062,11 +19061,11 @@ gboolean signalTooltipQuery(GtkWidget* pWidget, gint /*x*/, gint /*y*/, #endif // fallback to the mechanism which needs help installed - OString sHelpId = ::get_help_id(pWidget); + OUString sHelpId = ::get_help_id(pWidget); Help* pHelp = !sHelpId.isEmpty() ? Application::GetHelp() : nullptr; if (pHelp) { - OUString sHelpText = pHelp->GetHelpText(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), static_cast<weld::Widget*>(nullptr)); + OUString sHelpText = pHelp->GetHelpText(sHelpId, static_cast<weld::Widget*>(nullptr)); if (!sHelpText.isEmpty()) { gtk_tooltip_set_text(tooltip, OUStringToOString(sHelpText, RTL_TEXTENCODING_UTF8).getStr()); @@ -20756,7 +20755,7 @@ public: return create_virtual_device(); } - virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) override + virtual void set_item_menu(const OUString& rIdent, weld::Menu* pMenu) override { #if 0 m_xCustomMenuButtonHelper.reset(); @@ -20767,7 +20766,7 @@ public: gtk_widget_queue_resize_no_redraw(GTK_WIDGET(m_pOverlayButton)); // force location recalc if (pMenuWidget) m_xCustomMenuButtonHelper.reset(new CustomRenderMenuButtonHelper(GTK_MENU(pMenuWidget), GTK_TOGGLE_BUTTON(m_pToggleButton))); - m_sMenuButtonRow = OUString::fromUtf8(rIdent); + m_sMenuButtonRow = rIdent; #else (void)rIdent; (void)pMenu; #endif @@ -22565,7 +22564,7 @@ public: return create_virtual_device(); } - virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) override + virtual void set_item_menu(const OUString& rIdent, weld::Menu* pMenu) override { m_xCustomMenuButtonHelper.reset(); GtkInstanceMenu* pPopoverWidget = dynamic_cast<GtkInstanceMenu*>(pMenu); @@ -22575,7 +22574,7 @@ public: gtk_widget_queue_resize_no_redraw(GTK_WIDGET(m_pOverlayButton)); // force location recalc if (pMenuWidget) m_xCustomMenuButtonHelper.reset(new CustomRenderMenuButtonHelper(GTK_MENU(pMenuWidget), GTK_TOGGLE_BUTTON(m_pToggleButton))); - m_sMenuButtonRow = OUString::fromUtf8(rIdent); + m_sMenuButtonRow = rIdent; } OUString get_mru_entries() const override @@ -23004,7 +23003,7 @@ public: assert(false && "not implemented"); } - virtual void set_item_menu(const OString&, weld::Menu*) override + virtual void set_item_menu(const OUString&, weld::Menu*) override { assert(false && "not implemented"); } @@ -23559,7 +23558,7 @@ class GtkInstanceBuilder : public weld::Builder { private: ResHookProc m_pStringReplace; - OString m_aUtf8HelpRoot; + OUString m_aHelpRoot; OUString m_aIconTheme; OUString m_aUILang; GtkBuilder* m_pBuilder; @@ -23683,10 +23682,10 @@ private: #endif //set helpids - OString sBuildableName = ::get_buildable_id(GTK_BUILDABLE(pWidget)); + OUString sBuildableName = ::get_buildable_id(GTK_BUILDABLE(pWidget)); if (!sBuildableName.isEmpty()) { - OString sHelpId = m_aUtf8HelpRoot + sBuildableName; + OUString sHelpId = m_aHelpRoot + sBuildableName; set_help_id(pWidget, sHelpId); //hook up for extended help const ImplSVHelpData& aHelpData = ImplGetSVHelpData(); @@ -23891,7 +23890,7 @@ public: if (nIdx != -1) sHelpRoot = sHelpRoot.copy(0, nIdx); sHelpRoot += "/"; - m_aUtf8HelpRoot = OUStringToOString(sHelpRoot, RTL_TEXTENCODING_UTF8); + m_aHelpRoot = sHelpRoot; m_aIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); m_aUILang = Application::GetSettings().GetUILanguageTag().getBcp47(); @@ -23966,9 +23965,9 @@ public: m_aMnemonicButtons.clear(); } - OString get_current_page_help_id() + OUString get_current_page_help_id() { - OString sPageHelpId; + OUString sPageHelpId; // check to see if there is a notebook called tabcontrol and get the // helpid for the current page of that std::unique_ptr<weld::Notebook> xNotebook(weld_notebook("tabcontrol")); @@ -24014,18 +24013,18 @@ public: #endif } - virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OString &id) override + virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OUString &id) override { - GtkMessageDialog* pMessageDialog = GTK_MESSAGE_DIALOG(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkMessageDialog* pMessageDialog = GTK_MESSAGE_DIALOG(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pMessageDialog) return nullptr; gtk_window_set_transient_for(GTK_WINDOW(pMessageDialog), GTK_WINDOW(widget_get_toplevel(m_pParentWidget))); return std::make_unique<GtkInstanceMessageDialog>(pMessageDialog, this, true); } - virtual std::unique_ptr<weld::Assistant> weld_assistant(const OString &id) override + virtual std::unique_ptr<weld::Assistant> weld_assistant(const OUString &id) override { - GtkAssistant* pAssistant = GTK_ASSISTANT(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkAssistant* pAssistant = GTK_ASSISTANT(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pAssistant) return nullptr; if (m_pParentWidget) @@ -24033,9 +24032,9 @@ public: return std::make_unique<GtkInstanceAssistant>(pAssistant, this, true); } - virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString &id) override + virtual std::unique_ptr<weld::Dialog> weld_dialog(const OUString &id) override { - GtkWindow* pDialog = GTK_WINDOW(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkWindow* pDialog = GTK_WINDOW(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pDialog) return nullptr; if (m_pParentWidget) @@ -24086,21 +24085,21 @@ public: return std::make_unique<GtkInstanceDialog>(pDialog, this, true); } - virtual std::unique_ptr<weld::Widget> weld_widget(const OString &id) override + virtual std::unique_ptr<weld::Widget> weld_widget(const OUString &id) override { - GtkWidget* pWidget = GTK_WIDGET(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkWidget* pWidget = GTK_WIDGET(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pWidget) return nullptr; auto_add_parentless_widgets_to_container(pWidget); return std::make_unique<GtkInstanceWidget>(pWidget, this, false); } - virtual std::unique_ptr<weld::Container> weld_container(const OString &id) override + virtual std::unique_ptr<weld::Container> weld_container(const OUString &id) override { #if !GTK_CHECK_VERSION(4, 0, 0) - GtkContainer* pContainer = GTK_CONTAINER(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkContainer* pContainer = GTK_CONTAINER(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); #else - GtkWidget* pContainer = GTK_WIDGET(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkWidget* pContainer = GTK_WIDGET(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); #endif if (!pContainer) return nullptr; @@ -24108,72 +24107,72 @@ public: return std::make_unique<GtkInstanceContainer>(pContainer, this, false); } - virtual std::unique_ptr<weld::Box> weld_box(const OString &id) override + virtual std::unique_ptr<weld::Box> weld_box(const OUString &id) override { - GtkBox* pBox = GTK_BOX(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkBox* pBox = GTK_BOX(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pBox) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pBox)); return std::make_unique<GtkInstanceBox>(pBox, this, false); } - virtual std::unique_ptr<weld::Paned> weld_paned(const OString &id) override + virtual std::unique_ptr<weld::Paned> weld_paned(const OUString &id) override { - GtkPaned* pPaned = GTK_PANED(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkPaned* pPaned = GTK_PANED(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pPaned) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pPaned)); return std::make_unique<GtkInstancePaned>(pPaned, this, false); } - virtual std::unique_ptr<weld::Frame> weld_frame(const OString &id) override + virtual std::unique_ptr<weld::Frame> weld_frame(const OUString &id) override { - GtkFrame* pFrame = GTK_FRAME(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkFrame* pFrame = GTK_FRAME(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pFrame) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pFrame)); return std::make_unique<GtkInstanceFrame>(pFrame, this, false); } - virtual std::unique_ptr<weld::ScrolledWindow> weld_scrolled_window(const OString &id, bool bUserManagedScrolling = false) override + virtual std::unique_ptr<weld::ScrolledWindow> weld_scrolled_window(const OUString &id, bool bUserManagedScrolling = false) override { - GtkScrolledWindow* pScrolledWindow = GTK_SCROLLED_WINDOW(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkScrolledWindow* pScrolledWindow = GTK_SCROLLED_WINDOW(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pScrolledWindow) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pScrolledWindow)); return std::make_unique<GtkInstanceScrolledWindow>(pScrolledWindow, this, false, bUserManagedScrolling); } - virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString &id) override + virtual std::unique_ptr<weld::Notebook> weld_notebook(const OUString &id) override { - GtkNotebook* pNotebook = GTK_NOTEBOOK(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkNotebook* pNotebook = GTK_NOTEBOOK(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pNotebook) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pNotebook)); return std::make_unique<GtkInstanceNotebook>(pNotebook, this, false); } - virtual std::unique_ptr<weld::Button> weld_button(const OString &id) override + virtual std::unique_ptr<weld::Button> weld_button(const OUString &id) override { - GtkButton* pButton = GTK_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkButton* pButton = GTK_BUTTON(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pButton) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pButton)); return std::make_unique<GtkInstanceButton>(pButton, this, false); } - virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OString &id) override + virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OUString &id) override { - GtkMenuButton* pButton = GTK_MENU_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkMenuButton* pButton = GTK_MENU_BUTTON(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pButton) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pButton)); return std::make_unique<GtkInstanceMenuButton>(pButton, nullptr, this, false); } - virtual std::unique_ptr<weld::MenuToggleButton> weld_menu_toggle_button(const OString &id) override + virtual std::unique_ptr<weld::MenuToggleButton> weld_menu_toggle_button(const OUString &id) override { - GtkMenuButton* pButton = GTK_MENU_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkMenuButton* pButton = GTK_MENU_BUTTON(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pButton) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pButton)); @@ -24182,30 +24181,30 @@ public: return std::make_unique<GtkInstanceMenuToggleButton>(pMenuToggleButton, pButton, this, false); } - virtual std::unique_ptr<weld::LinkButton> weld_link_button(const OString &id) override + virtual std::unique_ptr<weld::LinkButton> weld_link_button(const OUString &id) override { - GtkLinkButton* pButton = GTK_LINK_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkLinkButton* pButton = GTK_LINK_BUTTON(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pButton) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pButton)); return std::make_unique<GtkInstanceLinkButton>(pButton, this, false); } - virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const OString &id) override + virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const OUString &id) override { - GtkToggleButton* pToggleButton = GTK_TOGGLE_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkToggleButton* pToggleButton = GTK_TOGGLE_BUTTON(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pToggleButton) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pToggleButton)); return std::make_unique<GtkInstanceToggleButton>(pToggleButton, this, false); } - virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OString &id) override + virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OUString &id) override { #if GTK_CHECK_VERSION(4, 0, 0) - GtkCheckButton* pRadioButton = GTK_CHECK_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkCheckButton* pRadioButton = GTK_CHECK_BUTTON(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); #else - GtkRadioButton* pRadioButton = GTK_RADIO_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkRadioButton* pRadioButton = GTK_RADIO_BUTTON(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); #endif if (!pRadioButton) return nullptr; @@ -24213,45 +24212,45 @@ public: return std::make_unique<GtkInstanceRadioButton>(pRadioButton, this, false); } - virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OString &id) override + virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OUString &id) override { - GtkCheckButton* pCheckButton = GTK_CHECK_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkCheckButton* pCheckButton = GTK_CHECK_BUTTON(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pCheckButton) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pCheckButton)); return std::make_unique<GtkInstanceCheckButton>(pCheckButton, this, false); } - virtual std::unique_ptr<weld::Scale> weld_scale(const OString &id) override + virtual std::unique_ptr<weld::Scale> weld_scale(const OUString &id) override { - GtkScale* pScale = GTK_SCALE(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkScale* pScale = GTK_SCALE(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pScale) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pScale)); return std::make_unique<GtkInstanceScale>(pScale, this, false); } - virtual std::unique_ptr<weld::ProgressBar> weld_progress_bar(const OString &id) override + virtual std::unique_ptr<weld::ProgressBar> weld_progress_bar(const OUString &id) override { - GtkProgressBar* pProgressBar = GTK_PROGRESS_BAR(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkProgressBar* pProgressBar = GTK_PROGRESS_BAR(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pProgressBar) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pProgressBar)); return std::make_unique<GtkInstanceProgressBar>(pProgressBar, this, false); } - virtual std::unique_ptr<weld::Spinner> weld_spinner(const OString &id) override + virtual std::unique_ptr<weld::Spinner> weld_spinner(const OUString &id) override { - GtkSpinner* pSpinner = GTK_SPINNER(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkSpinner* pSpinner = GTK_SPINNER(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pSpinner) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pSpinner)); return std::make_unique<GtkInstanceSpinner>(pSpinner, this, false); } - virtual std::unique_ptr<weld::Image> weld_image(const OString &id) override + virtual std::unique_ptr<weld::Image> weld_image(const OUString &id) override { - GtkWidget* pWidget = GTK_WIDGET(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkWidget* pWidget = GTK_WIDGET(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pWidget) return nullptr; if (GTK_IS_IMAGE(pWidget)) @@ -24269,50 +24268,50 @@ public: return nullptr; } - virtual std::unique_ptr<weld::Calendar> weld_calendar(const OString &id) override + virtual std::unique_ptr<weld::Calendar> weld_calendar(const OUString &id) override { - GtkCalendar* pCalendar = GTK_CALENDAR(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkCalendar* pCalendar = GTK_CALENDAR(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pCalendar) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pCalendar)); return std::make_unique<GtkInstanceCalendar>(pCalendar, this, false); } - virtual std::unique_ptr<weld::Entry> weld_entry(const OString &id) override + virtual std::unique_ptr<weld::Entry> weld_entry(const OUString &id) override { - GtkEntry* pEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkEntry* pEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pEntry) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pEntry)); return std::make_unique<GtkInstanceEntry>(pEntry, this, false); } - virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString &id) override + virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OUString &id) override { - GtkSpinButton* pSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkSpinButton* pSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pSpinButton) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pSpinButton)); return std::make_unique<GtkInstanceSpinButton>(pSpinButton, this, false); } - virtual std::unique_ptr<weld::MetricSpinButton> weld_metric_spin_button(const OString& id, FieldUnit eUnit) override + virtual std::unique_ptr<weld::MetricSpinButton> weld_metric_spin_button(const OUString& id, FieldUnit eUnit) override { return std::make_unique<weld::MetricSpinButton>(weld_spin_button(id), eUnit); } - virtual std::unique_ptr<weld::FormattedSpinButton> weld_formatted_spin_button(const OString &id) override + virtual std::unique_ptr<weld::FormattedSpinButton> weld_formatted_spin_button(const OUString &id) override { - GtkSpinButton* pSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkSpinButton* pSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pSpinButton) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pSpinButton)); return std::make_unique<GtkInstanceFormattedSpinButton>(pSpinButton, this, false); } - virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString &id) override + virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OUString &id) override { - GtkComboBox* pComboBox = GTK_COMBO_BOX(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkComboBox* pComboBox = GTK_COMBO_BOX(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pComboBox) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pComboBox)); @@ -24352,30 +24351,30 @@ public: #endif } - virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString &id) override + virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OUString &id) override { - GtkTreeView* pTreeView = GTK_TREE_VIEW(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkTreeView* pTreeView = GTK_TREE_VIEW(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pTreeView) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pTreeView)); return std::make_unique<GtkInstanceTreeView>(pTreeView, this, false); } - virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString &id) override + virtual std::unique_ptr<weld::IconView> weld_icon_view(const OUString &id) override { - GtkIconView* pIconView = GTK_ICON_VIEW(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkIconView* pIconView = GTK_ICON_VIEW(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pIconView) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pIconView)); return std::make_unique<GtkInstanceIconView>(pIconView, this, false); } - virtual std::unique_ptr<weld::EntryTreeView> weld_entry_tree_view(const OString& containerid, const OString& entryid, const OString& treeviewid) override + virtual std::unique_ptr<weld::EntryTreeView> weld_entry_tree_view(const OUString& containerid, const OUString& entryid, const OUString& treeviewid) override { #if GTK_CHECK_VERSION(4, 0, 0) - GtkWidget* pContainer = GTK_WIDGET(gtk_builder_get_object(m_pBuilder, containerid.getStr())); + GtkWidget* pContainer = GTK_WIDGET(gtk_builder_get_object(m_pBuilder, OUStringToOString(containerid, RTL_TEXTENCODING_UTF8).getStr())); #else - GtkContainer* pContainer = GTK_CONTAINER(gtk_builder_get_object(m_pBuilder, containerid.getStr())); + GtkContainer* pContainer = GTK_CONTAINER(gtk_builder_get_object(m_pBuilder, OUStringToOString(containerid, RTL_TEXTENCODING_UTF8).getStr())); #endif if (!pContainer) return nullptr; @@ -24385,58 +24384,58 @@ public: weld_tree_view(treeviewid)); } - virtual std::unique_ptr<weld::Label> weld_label(const OString &id) override + virtual std::unique_ptr<weld::Label> weld_label(const OUString &id) override { - GtkLabel* pLabel = GTK_LABEL(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkLabel* pLabel = GTK_LABEL(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pLabel) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pLabel)); return std::make_unique<GtkInstanceLabel>(pLabel, this, false); } - virtual std::unique_ptr<weld::TextView> weld_text_view(const OString &id) override + virtual std::unique_ptr<weld::TextView> weld_text_view(const OUString &id) override { - GtkTextView* pTextView = GTK_TEXT_VIEW(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkTextView* pTextView = GTK_TEXT_VIEW(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pTextView) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pTextView)); return std::make_unique<GtkInstanceTextView>(pTextView, this, false); } - virtual std::unique_ptr<weld::Expander> weld_expander(const OString &id) override + virtual std::unique_ptr<weld::Expander> weld_expander(const OUString &id) override { - GtkExpander* pExpander = GTK_EXPANDER(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkExpander* pExpander = GTK_EXPANDER(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pExpander) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pExpander)); return std::make_unique<GtkInstanceExpander>(pExpander, this, false); } - virtual std::unique_ptr<weld::DrawingArea> weld_drawing_area(const OString &id, const a11yref& rA11y, + virtual std::unique_ptr<weld::DrawingArea> weld_drawing_area(const OUString &id, const a11yref& rA11y, FactoryFunction /*pUITestFactoryFunction*/, void* /*pUserData*/) override { - GtkDrawingArea* pDrawingArea = GTK_DRAWING_AREA(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkDrawingArea* pDrawingArea = GTK_DRAWING_AREA(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pDrawingArea) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pDrawingArea)); return std::make_unique<GtkInstanceDrawingArea>(pDrawingArea, this, rA11y, false); } - virtual std::unique_ptr<weld::Menu> weld_menu(const OString &id) override + virtual std::unique_ptr<weld::Menu> weld_menu(const OUString &id) override { #if GTK_CHECK_VERSION(4, 0, 0) - GtkPopoverMenu* pMenu = GTK_POPOVER_MENU(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkPopoverMenu* pMenu = GTK_POPOVER_MENU(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); #else - GtkMenu* pMenu = GTK_MENU(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkMenu* pMenu = GTK_MENU(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); #endif if (!pMenu) return nullptr; return std::make_unique<GtkInstanceMenu>(pMenu, true); } - virtual std::unique_ptr<weld::Popover> weld_popover(const OString &id) override + virtual std::unique_ptr<weld::Popover> weld_popover(const OUString &id) override { - GtkPopover* pPopover = GTK_POPOVER(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkPopover* pPopover = GTK_POPOVER(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pPopover) return nullptr; #if GTK_CHECK_VERSION(4, 0, 0) @@ -24446,12 +24445,12 @@ public: #endif } - virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OString &id) override + virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OUString &id) override { #if GTK_CHECK_VERSION(4, 0, 0) - GtkBox* pToolbar = GTK_BOX(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkBox* pToolbar = GTK_BOX(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); #else - GtkToolbar* pToolbar = GTK_TOOLBAR(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkToolbar* pToolbar = GTK_TOOLBAR(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); #endif if (!pToolbar) return nullptr; @@ -24459,9 +24458,9 @@ public: return std::make_unique<GtkInstanceToolbar>(pToolbar, this, false); } - virtual std::unique_ptr<weld::Scrollbar> weld_scrollbar(const OString &id) override + virtual std::unique_ptr<weld::Scrollbar> weld_scrollbar(const OUString &id) override { - GtkScrollbar* pScrollbar = GTK_SCROLLBAR(gtk_builder_get_object(m_pBuilder, id.getStr())); + GtkScrollbar* pScrollbar = GTK_SCROLLBAR(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, RTL_TEXTENCODING_UTF8).getStr())); if (!pScrollbar) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pScrollbar)); @@ -24482,7 +24481,7 @@ void GtkInstanceWindow::help() GtkWidget* pWidget = gtk_window_get_focus(m_pWindow); if (!pWidget) pWidget = GTK_WIDGET(m_pWindow); - OString sHelpId = ::get_help_id(pWidget); + OUString sHelpId = ::get_help_id(pWidget); while (sHelpId.isEmpty()) { pWidget = gtk_widget_get_parent(pWidget); @@ -24507,7 +24506,7 @@ void GtkInstanceWindow::help() // was the original id if (m_pBuilder && sHelpId.endsWith("/help")) { - OString sPageId = m_pBuilder->get_current_page_help_id(); + OUString sPageId = m_pBuilder->get_current_page_help_id(); if (!sPageId.isEmpty()) sHelpId = sPageId; else @@ -24531,12 +24530,12 @@ void GtkInstanceWindow::help() } } #endif - pHelp->Start(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), pSource); + pHelp->Start(sHelpId, pSource); } //iterate upwards through the hierarchy from this widgets through its parents //calling func with their helpid until func returns true or we run out of parents -void GtkInstanceWidget::help_hierarchy_foreach(const std::function<bool(const OString&)>& func) +void GtkInstanceWidget::help_hierarchy_foreach(const std::function<bool(const OUString&)>& func) { GtkWidget* pParent = m_pWidget; while ((pParent = gtk_widget_get_parent(pParent))) @@ -24570,7 +24569,7 @@ gboolean GtkSalFrame::NativeWidgetHelpPressed(GtkAccelGroup*, GObject*, guint, G GtkWidget* pWidget = gtk_window_get_focus(pWindow); if (!pWidget) pWidget = GTK_WIDGET(pWindow); - OString sHelpId = ::get_help_id(pWidget); + OUString sHelpId = ::get_help_id(pWidget); while (sHelpId.isEmpty()) { pWidget = gtk_widget_get_parent(pWidget); @@ -24596,14 +24595,14 @@ gboolean GtkSalFrame::NativeWidgetHelpPressed(GtkAccelGroup*, GObject*, guint, G } if (!pChildWindow) return true; - pHelp->Start(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), pChildWindow); + pHelp->Start(sHelpId, pChildWindow); return true; } if (!pWidget) return true; std::unique_ptr<weld::Widget> xTemp(new GtkInstanceWidget(pWidget, nullptr, false)); - pHelp->Start(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), xTemp.get()); + pHelp->Start(sHelpId, xTemp.get()); return true; } #endif diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index b03db5fa6cf6..a85bffa79c6e 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -797,7 +797,7 @@ namespace static void MenuButtonClicked(GtkWidget* pWidget, gpointer pMenu) { - OString aId(get_buildable_id(GTK_BUILDABLE(pWidget))); + OUString aId(get_buildable_id(GTK_BUILDABLE(pWidget))); static_cast<MenuBar*>(pMenu)->HandleMenuButtonEvent(aId.toUInt32()); } @@ -835,7 +835,7 @@ bool GtkSalMenu::AddMenuBarButton(const SalMenuButtonItem& rNewItem) maExtraButtons.emplace_back(rNewItem.mnId, pButton); - set_buildable_id(GTK_BUILDABLE(pButton), OString::number(rNewItem.mnId).getStr()); + set_buildable_id(GTK_BUILDABLE(pButton), OUString::number(rNewItem.mnId)); gtk_widget_set_tooltip_text(pButton, rNewItem.maToolTipText.toUtf8().getStr()); diff --git a/vcl/unx/gtk4/convert3to4.cxx b/vcl/unx/gtk4/convert3to4.cxx index 272df9a5f74c..16c7403bb261 100644 --- a/vcl/unx/gtk4/convert3to4.cxx +++ b/vcl/unx/gtk4/convert3to4.cxx @@ -24,8 +24,8 @@ typedef std::pair<css::uno::Reference<css::xml::dom::XNode>, OUString> named_nod bool sortButtonNodes(const named_node& rA, const named_node& rB) { - OString sA(rA.second.toUtf8()); - OString sB(rB.second.toUtf8()); + OUString sA(rA.second); + OUString sB(rB.second); //order within groups according to platform rules return getButtonPriority(sA) < getButtonPriority(sB); } |