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 /sfx2/source/doc | |
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 'sfx2/source/doc')
-rw-r--r-- | sfx2/source/doc/autoredactdialog.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/doc/new.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 24 |
5 files changed, 19 insertions, 25 deletions
diff --git a/sfx2/source/doc/autoredactdialog.cxx b/sfx2/source/doc/autoredactdialog.cxx index 6e438a90bd1b..5e61849c079a 100644 --- a/sfx2/source/doc/autoredactdialog.cxx +++ b/sfx2/source/doc/autoredactdialog.cxx @@ -534,8 +534,7 @@ SfxAutoRedactDialog::SfxAutoRedactDialog(weld::Window* pParent) { // Can be used to remember the last set of redaction targets? OUString sExtraData; - SvtViewOptions aDlgOpt(EViewType::Dialog, - OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id()); if (aDlgOpt.Exists()) { @@ -586,8 +585,7 @@ SfxAutoRedactDialog::~SfxAutoRedactDialog() if (m_aTableTargets.empty()) { // Clear the dialog data - SvtViewOptions aDlgOpt(EViewType::Dialog, - OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id()); aDlgOpt.Delete(); return; } @@ -612,8 +610,7 @@ SfxAutoRedactDialog::~SfxAutoRedactDialog() OUString sUserDataStr(OUString::fromUtf8(aStream.str().c_str())); // Store the dialog data - SvtViewOptions aDlgOpt(EViewType::Dialog, - OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id()); aDlgOpt.SetUserItem("UserItem", css::uno::Any(sUserDataStr)); if (!m_bTargetsCopied) diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index a6922befcc95..a9bba4f0fc2d 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -271,7 +271,7 @@ SfxNewFileDialog::SfxNewFileDialog(weld::Window *pParent, SfxNewFileDialogMode n } OUString sExtraData; - SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id()); if (aDlgOpt.Exists()) { css::uno::Any aUserItem = aDlgOpt.GetUserItem("UserItem"); @@ -307,7 +307,7 @@ SfxNewFileDialog::SfxNewFileDialog(weld::Window *pParent, SfxNewFileDialogMode n SfxNewFileDialog::~SfxNewFileDialog() { - SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id()); aDlgOpt.SetUserItem("UserItem", css::uno::Any(m_xMoreBt->get_expanded() ? OUString("Y") : OUString("N"))); } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 1a0356279c4d..2d7b0c31ef6e 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1045,7 +1045,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } xHelper->GUIStoreModel( GetModel(), - OUString::createFromAscii( pSlot->GetUnoName() ), + pSlot->GetUnoName(), aDispatchArgs, bPreselectPassword, GetDocumentSignatureState(), diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 84797484d3a3..73f0a3137d7e 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3586,10 +3586,7 @@ static void ConvertSlotsToCommands( SfxObjectShell const * pDoc, Reference< cont const SfxSlot* pSlot = pModule->GetSlotPool()->GetSlot( nSlot ); if ( pSlot ) { - OUStringBuffer aStrBuf( ".uno:" ); - aStrBuf.appendAscii( pSlot->GetUnoName() ); - - aCommand = aStrBuf.makeStringAndClear(); + aCommand = pSlot->GetCommand(); aSeqPropValue.getArray()[nIndex].Value <<= aCommand; rToolbarDefinition->replaceByIndex( i, Any( aSeqPropValue )); } diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 6bbb7988e726..dec37dd0c406 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -58,16 +58,16 @@ constexpr OUStringLiteral TM_SETTING_LASTFOLDER = u"LastFolder"; constexpr OUStringLiteral TM_SETTING_LASTAPPLICATION = u"LastApplication"; constexpr OUStringLiteral TM_SETTING_VIEWMODE = u"ViewMode"; -#define MNI_ACTION_NEW_FOLDER "new" -#define MNI_ACTION_RENAME_FOLDER "rename" -#define MNI_ACTION_DELETE_FOLDER "delete" -#define MNI_ACTION_DEFAULT "default" -#define MNI_ACTION_DEFAULT_WRITER "default_writer" -#define MNI_ACTION_DEFAULT_CALC "default_calc" -#define MNI_ACTION_DEFAULT_IMPRESS "default_impress" -#define MNI_ACTION_DEFAULT_DRAW "default_draw" -#define MNI_ACTION_IMPORT "import_template" -#define MNI_ACTION_EXTENSIONS "extensions" +constexpr OUStringLiteral MNI_ACTION_NEW_FOLDER = u"new"; +constexpr OUStringLiteral MNI_ACTION_RENAME_FOLDER = u"rename"; +constexpr OUStringLiteral MNI_ACTION_DELETE_FOLDER = u"delete"; +constexpr OUStringLiteral MNI_ACTION_DEFAULT = u"default"; +constexpr OUStringLiteral MNI_ACTION_DEFAULT_WRITER = u"default_writer"; +constexpr OUStringLiteral MNI_ACTION_DEFAULT_CALC = u"default_calc"; +constexpr OUStringLiteral MNI_ACTION_DEFAULT_IMPRESS = u"default_impress"; +constexpr OUStringLiteral MNI_ACTION_DEFAULT_DRAW = u"default_draw"; +constexpr OUStringLiteral MNI_ACTION_IMPORT = u"import_template"; +constexpr OUStringLiteral MNI_ACTION_EXTENSIONS = u"extensions"; #define MNI_ALL_APPLICATIONS 0 #define MNI_WRITER 1 #define MNI_CALC 2 @@ -508,7 +508,7 @@ IMPL_LINK(SfxTemplateManagerDlg, TVItemStateHdl, const ThumbnailViewItem*, pItem OnTemplateState(pItem); } -IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, const OString&, rIdent, void) +IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, const OUString&, rIdent, void) { if (rIdent == MNI_ACTION_NEW_FOLDER) OnCategoryNew(); @@ -532,7 +532,7 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, const OString&, rIdent, void) ExtensionsActionHdl(); } -void SfxTemplateManagerDlg::DefaultTemplateMenuSelectHdl(std::string_view rIdent) +void SfxTemplateManagerDlg::DefaultTemplateMenuSelectHdl(std::u16string_view rIdent) { SvtModuleOptions aModOpt; OUString aFactoryURL; |