diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-26 15:57:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-26 17:29:46 +0100 |
commit | 26643b50a29cb25f4827aebbccc72beddeac7a69 (patch) | |
tree | 0cd5915a3e3d9ef1e310da0a167329b72ddd55de /svx/source | |
parent | 59b602dcdb445116dde3e50dce45974eec0e043b (diff) |
use more OUStringLiteral in svx
Change-Id: Ifdcfa4e1f9a42618061642ffe05eaa2a32e1010e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125882
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/unodraw/unoprov.cxx | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index 24ee596aa2a4..4d20dee09617 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -1027,7 +1027,7 @@ bool SvxFieldUnitToMeasureUnit( const FieldUnit eVcl, short& eApi ) noexcept return true; } -static const char* RID_SVXSTR_BMP_DEF[] = +constexpr rtl::OUStringConstExpr RID_SVXSTR_BMP_DEF[] = { RID_SVXSTR_BMP0_DEF, RID_SVXSTR_BMP1_DEF, @@ -1221,7 +1221,7 @@ const TranslateId RID_SVXSTR_BMP[] = RID_SVXSTR_BMP92 }; -static const char* RID_SVXSTR_DASH_DEF[] = +constexpr rtl::OUStringConstExpr RID_SVXSTR_DASH_DEF[] = { RID_SVXSTR_DASH0_DEF, RID_SVXSTR_DASH1_DEF, @@ -1292,7 +1292,7 @@ const TranslateId RID_SVXSTR_DASH[] = RID_SVXSTR_DASH30 }; -static const char* RID_SVXSTR_LEND_DEF[] = +constexpr rtl::OUStringConstExpr RID_SVXSTR_LEND_DEF[] = { RID_SVXSTR_LEND0_DEF, RID_SVXSTR_LEND1_DEF, @@ -1364,7 +1364,7 @@ const TranslateId RID_SVXSTR_LEND[] = RID_SVXSTR_LEND31 }; -static const char* RID_SVXSTR_GRDT_DEF[] = +constexpr rtl::OUStringConstExpr RID_SVXSTR_GRDT_DEF[] = { RID_SVXSTR_GRDT0_DEF, RID_SVXSTR_GRDT1_DEF, @@ -1542,7 +1542,7 @@ const TranslateId RID_SVXSTR_GRDT[] = RID_SVXSTR_GRDT84 }; -static const char* RID_SVXSTR_HATCHS_DEF[] = +constexpr rtl::OUStringConstExpr RID_SVXSTR_HATCHS_DEF[] = { RID_SVXSTR_HATCH0_DEF, RID_SVXSTR_HATCH1_DEF, @@ -1582,7 +1582,7 @@ const TranslateId RID_SVXSTR_HATCHS[] = RID_SVXSTR_HATCH15 }; -static const char* RID_SVXSTR_TRASNGR_DEF[] = +constexpr rtl::OUStringConstExpr RID_SVXSTR_TRASNGR_DEF[] = { RID_SVXSTR_TRASNGR0_DEF }; @@ -1592,7 +1592,7 @@ const TranslateId RID_SVXSTR_TRASNGR[] = RID_SVXSTR_TRASNGR0 }; -static bool SvxUnoGetResourceRanges( const sal_uInt16 nWhich, const char**& pApiResIds, const TranslateId*& pIntResIds, int& nCount ) noexcept +static bool SvxUnoGetResourceRanges( const sal_uInt16 nWhich, const rtl::OUStringConstExpr*& pApiResIds, const TranslateId*& pIntResIds, int& nCount ) noexcept { switch( nWhich ) { @@ -1639,7 +1639,7 @@ static bool SvxUnoGetResourceRanges( const sal_uInt16 nWhich, const char**& pApi } /// @throws std::exception -static bool SvxUnoConvertResourceStringToApi(const TranslateId* pSourceResIds, const char** pDestResIds, int nCount, OUString& rString) +static bool SvxUnoConvertResourceStringToApi(const TranslateId* pSourceResIds, const rtl::OUStringConstExpr* pDestResIds, int nCount, OUString& rString) { // first, calculate the search string length without an optional number after the name sal_Int32 nLength = rString.getLength(); @@ -1672,12 +1672,12 @@ static bool SvxUnoConvertResourceStringToApi(const TranslateId* pSourceResIds, c const OUString & aCompare = SvxResId(pSourceResIds[i]); if( aShortString == aCompare ) { - rString = rString.replaceAt( 0, aShortString.getLength(), OUString::createFromAscii(pDestResIds[i]) ); + rString = rString.replaceAt( 0, aShortString.getLength(), OUString(pDestResIds[i]) ); return true; } else if( rString == aCompare ) { - rString = OUString::createFromAscii(pDestResIds[i]); + rString = pDestResIds[i]; return true; } } @@ -1685,7 +1685,7 @@ static bool SvxUnoConvertResourceStringToApi(const TranslateId* pSourceResIds, c return false; } -static bool SvxUnoConvertResourceStringFromApi(const char** pSourceResIds, const TranslateId* pDestResIds, int nCount, OUString& rString) +static bool SvxUnoConvertResourceStringFromApi(const rtl::OUStringConstExpr* pSourceResIds, const TranslateId* pDestResIds, int nCount, OUString& rString) { // first, calculate the search string length without an optional number after the name sal_Int32 nLength = rString.getLength(); @@ -1716,12 +1716,12 @@ static bool SvxUnoConvertResourceStringFromApi(const char** pSourceResIds, const for (int i = 0; i < nCount; ++i) { auto pCompare = pSourceResIds[i]; - if( aShortString.equalsAscii(pCompare) ) + if( aShortString == pCompare ) { rString = rString.replaceAt( 0, aShortString.getLength(), SvxResId(pDestResIds[i]) ); return true; } - else if( rString.equalsAscii(pCompare) ) + else if( rString == pCompare ) { rString = SvxResId(pDestResIds[i]); return true; @@ -1742,7 +1742,7 @@ static bool SvxUnoConvertResourceStringFromApi(const char** pSourceResIds, const // the possibility to define it wrong // - change the compare to also work when a shorter name is in front of a longer one -static const char* SvxUnoColorNameDefResId[] = +constexpr rtl::OUStringConstExpr SvxUnoColorNameDefResId[] = { RID_SVXSTR_COLOR_BLUEGREY_DEF, RID_SVXSTR_COLOR_BLACK_DEF, @@ -1951,7 +1951,7 @@ const TranslateId SvxUnoColorNameResId[] = }; /// @throws std::exception -static bool SvxUnoConvertResourceStringBuiltInToApi(const TranslateId* pSourceResIds, const char** pDestResIds, int nCount, OUString& rString) +static bool SvxUnoConvertResourceStringBuiltInToApi(const TranslateId* pSourceResIds, rtl::OUStringConstExpr const *pDestResIds, int nCount, OUString& rString) { //We replace e.g. "Gray 10%" with the translation of Gray, but we shouldn't //replace "Red Hat 1" with the translation of Red :-) @@ -1970,7 +1970,7 @@ static bool SvxUnoConvertResourceStringBuiltInToApi(const TranslateId* pSourceRe OUString aStrDefName = SvxResId(pSourceResIds[i]); if( sStr == aStrDefName ) { - OUString aReplace = OUString::createFromAscii(pDestResIds[i]); + OUString aReplace = pDestResIds[i]; rString = rString.replaceAt( 0, aStrDefName.getLength(), aReplace ); return true; } @@ -1979,7 +1979,7 @@ static bool SvxUnoConvertResourceStringBuiltInToApi(const TranslateId* pSourceRe return false; } -static bool SvxUnoConvertResourceStringBuiltInFromApi(const char** pSourceResIds, const TranslateId* pDestResIds, int nCount, OUString& rString) +static bool SvxUnoConvertResourceStringBuiltInFromApi(rtl::OUStringConstExpr const *pSourceResIds, const TranslateId* pDestResIds, int nCount, OUString& rString) { //We replace e.g. "Gray 10%" with the translation of Gray, but we shouldn't //replace "Red Hat 1" with the translation of Red :-) @@ -1995,10 +1995,10 @@ static bool SvxUnoConvertResourceStringBuiltInFromApi(const char** pSourceResIds for(int i = 0; i < nCount; ++i ) { - if( sStr.equalsAscii(pSourceResIds[i]) ) + if( sStr == pSourceResIds[i] ) { OUString aReplace = SvxResId(pDestResIds[i]); - rString = rString.replaceAt( 0, strlen(pSourceResIds[i]), aReplace ); + rString = rString.replaceAt( 0, OUString(pSourceResIds[i]).getLength(), aReplace ); return true; } } @@ -2022,7 +2022,7 @@ OUString SvxUnogetApiNameForItem(const sal_uInt16 nWhich, const OUString& rInter } else { - const char** pApiResIds; + const rtl::OUStringConstExpr* pApiResIds; const TranslateId* pIntResIds; int nCount; @@ -2055,7 +2055,7 @@ OUString SvxUnogetInternalNameForItem(const sal_uInt16 nWhich, const OUString& r } else { - const char** pApiResIds; + const rtl::OUStringConstExpr* pApiResIds; const TranslateId* pIntResIds; int nCount; |