diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-22 14:08:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-23 14:00:08 +0100 |
commit | ec1c4c49301758c54394f9943252e192ad54638b (patch) | |
tree | b53af3cb9154a388495b1af35c3f8ff41d6ebe1f /cui/source | |
parent | db0f2c29bf3a6ad5a08f8524ea0e65aa90792bb2 (diff) |
O[U]String::replaceAt overloads that take string_view
which results in lots of nice string_view improvements picked up by the
plugins
Change-Id: Ib0ec3887816b3d4436d003b739d9814f83e244b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125657
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/customize/cfg.cxx | 4 | ||||
-rw-r--r-- | cui/source/dialogs/about.cxx | 2 | ||||
-rw-r--r-- | cui/source/dialogs/hyphen.cxx | 4 | ||||
-rw-r--r-- | cui/source/dialogs/scriptdlg.cxx | 12 | ||||
-rw-r--r-- | cui/source/tabpages/numfmt.cxx | 6 |
5 files changed, 14 insertions, 14 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 79961fe690c2..526aa4e9c411 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -2990,7 +2990,7 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem( namespace { - OUString ReplaceIconName(const OUString& rMessage) + OUString ReplaceIconName(std::u16string_view rMessage) { OUString name; OUString message = CuiResId( RID_SVXSTR_REPLACE_ICON_WARNING ); @@ -3009,7 +3009,7 @@ namespace private: std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - SvxIconReplacementDialog(weld::Window *pParent, const OUString& rMessage, bool bYestoAll) + SvxIconReplacementDialog(weld::Window *pParent, std::u16string_view rMessage, bool bYestoAll) : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Warning, VclButtonsType::NONE, ReplaceIconName(rMessage))) { m_xQueryBox->set_title(CuiResId(RID_SVXSTR_REPLACE_ICON_CONFIRM)); diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index 36a7e6e69656..7216ca55e3b8 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -76,7 +76,7 @@ AboutDialog::AboutDialog(weld::Window *pParent) m_pBuildLabel->set_uri("https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h=" + sbuildId); m_pBuildLabel->set_label(sbuildId.getLength() > nMaxChar ? sbuildId.replaceAt( - nMaxChar, sbuildId.getLength() - nMaxChar, "...") + nMaxChar, sbuildId.getLength() - nMaxChar, u"...") : sbuildId); } else { m_pBuildCaption->hide(); diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx index a16dca1e20a3..0535902d4447 100644 --- a/cui/source/dialogs/hyphen.cxx +++ b/cui/source/dialogs/hyphen.cxx @@ -263,7 +263,7 @@ bool SvxHyphenWordDialog::SelLeft() DBG_ASSERT(i <= aTxt.getLength(), "index out of range"); if (aTxt[ i ] == sal_Unicode( HYPH_POS_CHAR )) { - aTxt = aTxt.replaceAt( i, 1, OUString( CUR_HYPH_POS_CHAR ) ); + aTxt = aTxt.replaceAt( i, 1, rtl::OUStringChar( CUR_HYPH_POS_CHAR ) ); m_nOldPos = i; m_xWordEdit->set_text(aTxt); @@ -286,7 +286,7 @@ bool SvxHyphenWordDialog::SelRight() { if (aTxt[ i ] == sal_Unicode( HYPH_POS_CHAR )) { - aTxt = aTxt.replaceAt( i, 1, OUString( CUR_HYPH_POS_CHAR ) ); + aTxt = aTxt.replaceAt( i, 1, rtl::OUStringChar( CUR_HYPH_POS_CHAR ) ); m_nOldPos = i; m_xWordEdit->set_text(aTxt); diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index 3bc7a52b40ab..acbdad7a1b16 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -1091,11 +1091,11 @@ namespace { OUString ReplaceString( const OUString& source, const OUString& token, - const OUString& value ) + std::u16string_view value ) { sal_Int32 pos = source.indexOf( token ); - if ( pos != -1 && !value.isEmpty() ) + if ( pos != -1 && !value.empty() ) { return source.replaceAt( pos, token.getLength(), value ); } @@ -1107,9 +1107,9 @@ OUString ReplaceString( OUString FormatErrorString( const OUString& unformatted, - const OUString& language, - const OUString& script, - const OUString& line, + std::u16string_view language, + std::u16string_view script, + std::u16string_view line, std::u16string_view type, std::u16string_view message ) { @@ -1247,7 +1247,7 @@ OUString GetErrorMessage( message = sError.Message; } return FormatErrorString( - unformatted, language, script, OUString(), std::u16string_view(), message ); + unformatted, language, script, u"", std::u16string_view(), message ); } OUString GetErrorMessage( const css::uno::Any& aException ) diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index 3058847d3c8a..219972d75edc 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -103,12 +103,12 @@ void SvxNumberPreview::NotifyChange( const OUString& rPrevStr, { mnChar = aPrevStr[ mnPos + 1 ]; // delete placeholder and char to repeat - aPrevStr = aPrevStr.replaceAt( mnPos, 2, "" ); + aPrevStr = aPrevStr.replaceAt( mnPos, 2, u"" ); } else { // delete placeholder - aPrevStr = aPrevStr.replaceAt( mnPos, 1, "" ); + aPrevStr = aPrevStr.replaceAt( mnPos, 1, u"" ); // do not attempt to draw a 0 fill character mnPos = -1; } @@ -158,7 +158,7 @@ void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools:: if (nNumCharsToInsert > 0) { for (int i = 0; i < nNumCharsToInsert; ++i) - aTmpStr = aTmpStr.replaceAt(mnPos, 0, OUString(mnChar)); + aTmpStr = aTmpStr.replaceAt(mnPos, 0, rtl::OUStringChar(mnChar)); } } |