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 /fpicker/source | |
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 'fpicker/source')
-rw-r--r-- | fpicker/source/office/OfficeControlAccess.cxx | 14 | ||||
-rw-r--r-- | fpicker/source/office/PlacesListBox.hxx | 2 | ||||
-rw-r--r-- | fpicker/source/office/RemoteFilesDialog.cxx | 8 | ||||
-rw-r--r-- | fpicker/source/office/RemoteFilesDialog.hxx | 2 | ||||
-rw-r--r-- | fpicker/source/office/fileview.cxx | 18 | ||||
-rw-r--r-- | fpicker/source/office/fileview.hxx | 4 | ||||
-rw-r--r-- | fpicker/source/office/fpdialogbase.hxx | 2 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 4 | ||||
-rw-r--r-- | fpicker/source/office/iodlgimp.cxx | 4 | ||||
-rw-r--r-- | fpicker/source/office/iodlgimp.hxx | 6 |
10 files changed, 31 insertions, 33 deletions
diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx index 3d06627dac24..62407da93252 100644 --- a/fpicker/source/office/OfficeControlAccess.cxx +++ b/fpicker/source/office/OfficeControlAccess.cxx @@ -182,20 +182,19 @@ namespace svt if (aHID.GetProtocol() == INetProtocol::Hid) sHelpID = aHID.GetURLPath(); - // URLs should always be UTF8 encoded and escaped - OString sID( OUStringToOString( sHelpID, RTL_TEXTENCODING_UTF8 ) ); + // URLs should always be escaped if (IsFileViewWidget(pControl)) { // the file view "overrides" the SetHelpId - m_pFileView->set_help_id(sID); + m_pFileView->set_help_id(sHelpID); } else - pControl->set_help_id(sID); + pControl->set_help_id(sHelpID); } OUString OControlAccess::getHelpURL(weld::Widget const * pControl) const { - OString aHelpId = pControl->get_help_id(); + OUString aHelpId = pControl->get_help_id(); if (IsFileViewWidget(pControl)) { // the file view "overrides" the SetHelpId @@ -203,11 +202,10 @@ namespace svt } OUString sHelpURL; - OUString aTmp( OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ) ); - INetURLObject aHID( aTmp ); + INetURLObject aHID(aHelpId); if ( aHID.GetProtocol() == INetProtocol::NotValid ) sHelpURL = INET_HID_SCHEME; - sHelpURL += aTmp; + sHelpURL += aHelpId; return sHelpURL; } diff --git a/fpicker/source/office/PlacesListBox.hxx b/fpicker/source/office/PlacesListBox.hxx index ed3a0798e9e7..934126072d53 100644 --- a/fpicker/source/office/PlacesListBox.hxx +++ b/fpicker/source/office/PlacesListBox.hxx @@ -52,7 +52,7 @@ public: void SetDelEnabled( bool enabled ); void updateView( ); - void set_help_id(const OString& rHelpId) { mxImpl->set_help_id(rHelpId); } + void set_help_id(const OUString& rHelpId) { mxImpl->set_help_id(rHelpId); } private: diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index adaf756d3d8e..ae03c2774f38 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -124,7 +124,7 @@ RemoteFilesDialog::~RemoteFilesDialog() if( !m_sIniKey.isEmpty() ) { SvtViewOptions aDlgOpt( EViewType::Dialog, m_sIniKey ); - aDlgOpt.SetWindowState(OStringToOUString(m_xDialog->get_window_state(vcl::WindowDataMask::All), RTL_TEXTENCODING_UTF8)); + aDlgOpt.SetWindowState(m_xDialog->get_window_state(vcl::WindowDataMask::All)); Size aSize(m_xDialog->get_size()); @@ -236,7 +236,7 @@ void RemoteFilesDialog::InitSize() if( !aDlgOpt.Exists() ) return; - m_xDialog->set_window_state(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_UTF8)); + m_xDialog->set_window_state(aDlgOpt.GetWindowState()); Any aUserData = aDlgOpt.GetUserItem( "UserData" ); OUString sCfgStr; @@ -566,9 +566,9 @@ IMPL_LINK_NOARG( RemoteFilesDialog, SelectServiceHdl, weld::ComboBox&, void ) } } -IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, const OString&, rIdent, void ) +IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, const OUString&, rIdent, void ) { - OString sIdent(rIdent); + OUString sIdent(rIdent); if( sIdent == "edit_service" && m_xServices_lb->get_count() > 0 ) { int nSelected = m_xServices_lb->get_active(); diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx index 3dfb4e1dc9aa..8c4fa0a4cbb3 100644 --- a/fpicker/source/office/RemoteFilesDialog.hxx +++ b/fpicker/source/office/RemoteFilesDialog.hxx @@ -161,7 +161,7 @@ private: void AddService(); DECL_LINK ( SelectServiceHdl, weld::ComboBox&, void ); - DECL_LINK ( EditServiceMenuHdl, const OString&, void ); + DECL_LINK ( EditServiceMenuHdl, const OUString&, void ); DECL_LINK( DoubleClickHdl, SvtFileView*, bool ); DECL_LINK( SelectHdl, SvtFileView*, void ); diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx index ac8ea43b55cd..2568779b6bfe 100644 --- a/fpicker/source/office/fileview.cxx +++ b/fpicker/source/office/fileview.cxx @@ -193,8 +193,8 @@ public: void grab_focus() { mxTreeView->grab_focus(); } bool has_focus() const { return mxTreeView->has_focus(); } - void set_help_id(const OString& rHelpId) { mxTreeView->set_help_id(rHelpId); } - OString get_help_id() const { return mxTreeView->get_help_id(); } + void set_help_id(const OUString& rHelpId) { mxTreeView->set_help_id(rHelpId); } + OUString get_help_id() const { return mxTreeView->get_help_id(); } bool IsEditingActive() const { return mbEditing; } @@ -229,7 +229,7 @@ public: DECL_LINK(EditedEntryHdl, const IterString&, bool); DECL_LINK(KeyInputHdl, const KeyEvent&, bool); - void ExecuteContextMenuAction(std::string_view rSelectedPopentry); + void ExecuteContextMenuAction(std::u16string_view rSelectedPopentry); }; } @@ -570,18 +570,18 @@ IMPL_LINK(ViewTabListBox_Impl, CommandHdl, const CommandEvent&, rCEvt, bool) auto xContextMenu = xBuilder->weld_menu("menu"); xContextMenu->set_visible("delete", bEnableDelete); xContextMenu->set_visible("rename", bEnableRename); - OString sCommand(xContextMenu->popup_at_rect(mxTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)))); + OUString sCommand(xContextMenu->popup_at_rect(mxTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)))); ExecuteContextMenuAction(sCommand); } return true; } -void ViewTabListBox_Impl::ExecuteContextMenuAction(std::string_view rSelectedPopupEntry) +void ViewTabListBox_Impl::ExecuteContextMenuAction(std::u16string_view rSelectedPopupEntry) { - if (rSelectedPopupEntry == "delete") + if (rSelectedPopupEntry == u"delete") DeleteEntries(); - else if (rSelectedPopupEntry == "rename") + else if (rSelectedPopupEntry == u"rename") { std::unique_ptr<weld::TreeIter> xEntry = mxTreeView->make_iterator(); if (mxTreeView->get_selected(xEntry.get())) @@ -914,12 +914,12 @@ bool SvtFileView::GetParentURL( OUString& rParentURL ) const return bRet; } -OString SvtFileView::get_help_id() const +OUString SvtFileView::get_help_id() const { return mpImpl->mxView->get_help_id(); } -void SvtFileView::set_help_id(const OString& rHelpId) +void SvtFileView::set_help_id(const OUString& rHelpId) { mpImpl->mxView->set_help_id(rHelpId); } diff --git a/fpicker/source/office/fileview.hxx b/fpicker/source/office/fileview.hxx index e2f132029de9..a19c2095507f 100644 --- a/fpicker/source/office/fileview.hxx +++ b/fpicker/source/office/fileview.hxx @@ -82,8 +82,8 @@ public: bool GetParentURL( OUString& _rParentURL ) const; void CreatedFolder( const OUString& rUrl, const OUString& rNewFolder ); - void set_help_id(const OString& rHelpId); - OString get_help_id() const; + void set_help_id(const OUString& rHelpId); + OUString get_help_id() const; void grab_focus(); bool has_focus() const; diff --git a/fpicker/source/office/fpdialogbase.hxx b/fpicker/source/office/fpdialogbase.hxx index 20ab362971f4..f0ab32184a7e 100644 --- a/fpicker/source/office/fpdialogbase.hxx +++ b/fpicker/source/office/fpdialogbase.hxx @@ -59,7 +59,7 @@ inline constexpr OUStringLiteral FILEDIALOG_FILTER_ALL = u"*.*"; class SvtFileDialog_Base : public weld::GenericDialogController, public ::svt::IFilePickerController { public: - SvtFileDialog_Base(weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID) + SvtFileDialog_Base(weld::Window* pParent, const OUString& rUIXMLDescription, const OUString& rID) : weld::GenericDialogController(pParent, rUIXMLDescription, rID) { } diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index a023cd2c0d21..0536a87d411a 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -467,7 +467,7 @@ SvtFileDialog::~SvtFileDialog() { // save window state SvtViewOptions aDlgOpt( EViewType::Dialog, m_xImpl->m_aIniKey ); - aDlgOpt.SetWindowState(OStringToOUString(m_xDialog->get_window_state(vcl::WindowDataMask::All), RTL_TEXTENCODING_UTF8)); + aDlgOpt.SetWindowState(m_xDialog->get_window_state(vcl::WindowDataMask::All)); OUString sUserData = m_xFileView->GetConfigString(); aDlgOpt.SetUserItem( "UserData", Any( sUserData ) ); @@ -1783,7 +1783,7 @@ void SvtFileDialog::InitSize() if ( aDlgOpt.Exists() ) { - m_xDialog->set_window_state(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_UTF8)); + m_xDialog->set_window_state(aDlgOpt.GetWindowState()); Any aUserData = aDlgOpt.GetUserItem( "UserData"); OUString sCfgStr; diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx index e9e8e00491fa..5b2a67e38de5 100644 --- a/fpicker/source/office/iodlgimp.cxx +++ b/fpicker/source/office/iodlgimp.cxx @@ -101,7 +101,7 @@ void SvtUpButton_Impl::FillURLMenu() } } -IMPL_LINK(SvtUpButton_Impl, SelectHdl, const OString&, rId, void) +IMPL_LINK(SvtUpButton_Impl, SelectHdl, const OUString&, rId, void) { sal_uInt32 nId = rId.toUInt32(); if (nId) @@ -113,7 +113,7 @@ IMPL_LINK(SvtUpButton_Impl, SelectHdl, const OString&, rId, void) } } -IMPL_LINK_NOARG(SvtUpButton_Impl, ClickHdl, const OString&, void) +IMPL_LINK_NOARG(SvtUpButton_Impl, ClickHdl, const OUString&, void) { m_pDlg->PrevLevel_Impl(); } diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx index caac91793c59..3a02dbbee641 100644 --- a/fpicker/source/office/iodlgimp.hxx +++ b/fpicker/source/office/iodlgimp.hxx @@ -86,7 +86,7 @@ public: std::unique_ptr<weld::Menu> xMenu, SvtFileDialog* pDlg); - void set_help_id(const OString& rHelpId) { m_xToolbar->set_help_id(rHelpId); } + void set_help_id(const OUString& rHelpId) { m_xToolbar->set_help_id(rHelpId); } void show() { m_xToolbar->show(); } void FillURLMenu(); @@ -95,8 +95,8 @@ public: private: - DECL_LINK(SelectHdl, const OString&, void); - DECL_LINK(ClickHdl, const OString&, void); + DECL_LINK(SelectHdl, const OUString&, void); + DECL_LINK(ClickHdl, const OUString&, void); }; class SvtURLBox; |