From b946842a744c2b869e5c01adf90335edf07f09ad Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 18 Oct 2023 07:37:17 +0200 Subject: Clean up the remaining uses of OUStringConstExpr, and drop it Change-Id: I30b2ac77b58e2ae1d1e997a0c830c513542b973d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158101 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- svx/source/dialog/frmsel.cxx | 4 ++-- svx/source/fmcomp/fmgridif.cxx | 6 ++--- svx/source/form/fmdmod.cxx | 2 +- svx/source/form/fmshimp.cxx | 2 +- svx/source/form/fmundo.cxx | 5 ++-- svx/source/gallery2/gallery1.cxx | 2 +- svx/source/tbxctrls/extrusioncontrols.cxx | 16 ++++++------- svx/source/tbxctrls/grafctrl.cxx | 4 ++-- svx/source/unodraw/unoprov.cxx | 40 +++++++++++++++---------------- 9 files changed, 41 insertions(+), 40 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index 1fde68ed7c0d..337013e55d34 100644 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -313,7 +313,7 @@ void FrameSelectorImpl::InitColors() maHCLineCol = COL_BLACK; } -constexpr rtl::OUStringConstExpr aImageIds[] = +constexpr OUString aImageIds[] = { RID_SVXBMP_FRMSEL_ARROW1, RID_SVXBMP_FRMSEL_ARROW2, @@ -350,7 +350,7 @@ void FrameSelectorImpl::InitArrowImageList() assert(SAL_N_ELEMENTS(aImageIds) == 16); for (size_t i = 0; i < SAL_N_ELEMENTS(aImageIds); ++i) { - BitmapEx aBmpEx { OUString(aImageIds[i]) }; + BitmapEx aBmpEx { aImageIds[i] }; aBmpEx.Replace(pColorAry1, pColorAry2, 3); maArrows.emplace_back(aBmpEx); } diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index d7fe7c9c23dd..7f367a2d99a3 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1551,7 +1551,7 @@ Reference< XIndexContainer > FmXGridPeer::getColumns() void FmXGridPeer::addColumnListeners(const Reference< XPropertySet >& xCol) { - static const rtl::OUStringConstExpr aPropsListenedTo[] = + static constexpr OUString aPropsListenedTo[] = { FM_PROP_LABEL, FM_PROP_WIDTH, FM_PROP_HIDDEN, FM_PROP_ALIGN, FM_PROP_FORMATKEY @@ -1576,7 +1576,7 @@ void FmXGridPeer::removeColumnListeners(const Reference< XPropertySet >& xCol) { // the same props as in addColumnListeners... linux has problems with global static UStrings, so // we have to do it this way... - static const rtl::OUStringConstExpr aPropsListenedTo[] = + static constexpr OUString aPropsListenedTo[] = { FM_PROP_LABEL, FM_PROP_WIDTH, FM_PROP_HIDDEN, FM_PROP_ALIGN, FM_PROP_FORMATKEY @@ -2648,7 +2648,7 @@ Sequence< css::util::URL>& FmXGridPeer::getSupportedURLs() { static Sequence< css::util::URL> aSupported = []() { - static const rtl::OUStringConstExpr sSupported[] = { + static constexpr OUString sSupported[] = { FMURL_RECORD_MOVEFIRST, FMURL_RECORD_MOVEPREV, FMURL_RECORD_MOVENEXT, diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx index 56aa46447a20..87c13e44e608 100644 --- a/svx/source/form/fmdmod.cxx +++ b/svx/source/form/fmdmod.cxx @@ -58,7 +58,7 @@ using namespace ::svxform; ::com::sun::star::uno::Sequence< OUString > SAL_CALL SvxFmMSFactory::getAvailableServiceNames() { - static const rtl::OUStringConstExpr aSvxComponentServiceNameList[] = + static constexpr OUString aSvxComponentServiceNameList[] = { FM_SUN_COMPONENT_TEXTFIELD, FM_SUN_COMPONENT_FORM, diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 8e7278f7e3fe..dd71f6999ade 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -204,7 +204,7 @@ static std::u16string_view aConvertSlots[] = u"ConvertToNavigationBar" }; -constexpr rtl::OUStringConstExpr aImgIds[] = +constexpr OUString aImgIds[] = { RID_SVXBMP_EDITBOX, RID_SVXBMP_BUTTON, diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index ba693fb02a92..e4a50a7ef275 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -536,11 +537,11 @@ void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt) return; // if it's a "default value" property of a control model, set the according "value" property - static constexpr rtl::OUStringConstExpr pDefaultValueProperties[] = { + static constexpr std::u16string_view pDefaultValueProperties[] = { FM_PROP_DEFAULT_TEXT, FM_PROP_DEFAULTCHECKED, FM_PROP_DEFAULT_DATE, FM_PROP_DEFAULT_TIME, FM_PROP_DEFAULT_VALUE, FM_PROP_DEFAULT_SELECT_SEQ, FM_PROP_EFFECTIVE_DEFAULT }; - static constexpr rtl::OUStringConstExpr aValueProperties[] = { + static constexpr OUString aValueProperties[] = { FM_PROP_TEXT, FM_PROP_STATE, FM_PROP_DATE, FM_PROP_TIME, FM_PROP_VALUE, FM_PROP_SELECT_SEQ, FM_PROP_EFFECTIVE_VALUE }; diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index 17bc19a8990a..8a3d23f3042f 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -53,7 +53,7 @@ using namespace ::com::sun::star; -const std::pair aUnlocalized[] = +constexpr std::pair aUnlocalized[] = { { GALLERY_THEME_HOMEPAGE, RID_GALLERYSTR_THEME_HTMLBUTTONS }, { GALLERY_THEME_POWERPOINT, RID_GALLERYSTR_THEME_POWERPOINT }, diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index 9affab6d7988..80258b61df65 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -47,7 +47,7 @@ constexpr OUStringLiteral g_sExtrusionDirection = u".uno:ExtrusionDirection"; constexpr OUStringLiteral g_sExtrusionProjection = u".uno:ExtrusionProjection"; constexpr OUStringLiteral EMPTY = u""; -constexpr rtl::OUStringConstExpr aLightOffBmps[] = +constexpr OUString aLightOffBmps[] = { RID_SVXBMP_LIGHT_OFF_FROM_TOP_LEFT, RID_SVXBMP_LIGHT_OFF_FROM_TOP, @@ -60,7 +60,7 @@ constexpr rtl::OUStringConstExpr aLightOffBmps[] = RID_SVXBMP_LIGHT_OFF_FROM_BOTTOM_RIGHT }; -constexpr rtl::OUStringConstExpr aLightOnBmps[] = +constexpr OUString aLightOnBmps[] = { RID_SVXBMP_LIGHT_ON_FROM_TOP_LEFT, RID_SVXBMP_LIGHT_ON_FROM_TOP, @@ -73,7 +73,7 @@ constexpr rtl::OUStringConstExpr aLightOnBmps[] = RID_SVXBMP_LIGHT_ON_FROM_BOTTOM_RIGHT }; -constexpr rtl::OUStringConstExpr aLightPreviewBmps[] = +constexpr OUString aLightPreviewBmps[] = { RID_SVXBMP_LIGHT_PREVIEW_FROM_TOP_LEFT, RID_SVXBMP_LIGHT_PREVIEW_FROM_TOP, @@ -86,7 +86,7 @@ constexpr rtl::OUStringConstExpr aLightPreviewBmps[] = RID_SVXBMP_LIGHT_PREVIEW_FROM_BOTTOM_RIGHT }; -constexpr rtl::OUStringConstExpr aDirectionBmps[] = +constexpr OUString aDirectionBmps[] = { RID_SVXBMP_DIRECTION_DIRECTION_NW, RID_SVXBMP_DIRECTION_DIRECTION_N, @@ -126,7 +126,7 @@ ExtrusionDirectionWindow::ExtrusionDirectionWindow( for (sal_uInt16 i = DIRECTION_NW; i <= DIRECTION_SE; ++i) { - maImgDirection[i] = Image(StockImage::Yes, OUString(aDirectionBmps[i])); + maImgDirection[i] = Image(StockImage::Yes, aDirectionBmps[i]); } mxDirectionSet->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectValueSetHdl ) ); @@ -604,10 +604,10 @@ ExtrusionLightingWindow::ExtrusionLightingWindow(svt::PopupWindowController* pCo { if( i != FROM_FRONT ) { - maImgLightingOff[i] = Image(StockImage::Yes, OUString(aLightOffBmps[i])); - maImgLightingOn[i] = Image(StockImage::Yes, OUString(aLightOnBmps[i])); + maImgLightingOff[i] = Image(StockImage::Yes, aLightOffBmps[i]); + maImgLightingOn[i] = Image(StockImage::Yes, aLightOnBmps[i]); } - maImgLightingPreview[i] = Image(StockImage::Yes, OUString(aLightPreviewBmps[i])); + maImgLightingPreview[i] = Image(StockImage::Yes, aLightPreviewBmps[i]); } mxLightingSet->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING ); diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index cd2533538466..4a1cd448900e 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.cxx @@ -156,7 +156,7 @@ namespace { struct CommandToRID { const char* pCommand; - rtl::OUStringConstExpr sResId; + OUString sResId; }; } @@ -164,7 +164,7 @@ struct CommandToRID static OUString ImplGetRID( std::u16string_view aCommand ) { static constexpr OUStringLiteral EMPTY = u""; - static const CommandToRID aImplCommandToResMap[] = + static constexpr CommandToRID aImplCommandToResMap[] = { { ".uno:GrafRed", RID_SVXBMP_GRAF_RED }, { ".uno:GrafGreen", RID_SVXBMP_GRAF_GREEN }, diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index d43b8241cc66..13bd99fa4561 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -1006,7 +1006,7 @@ bool SvxFieldUnitToMeasureUnit( const FieldUnit eVcl, short& eApi ) noexcept return true; } -constexpr rtl::OUStringConstExpr RID_SVXSTR_BMP_DEF[] = +constexpr OUString RID_SVXSTR_BMP_DEF[] = { RID_SVXSTR_BMP0_DEF, RID_SVXSTR_BMP1_DEF, @@ -1200,7 +1200,7 @@ const TranslateId RID_SVXSTR_BMP[] = RID_SVXSTR_BMP92 }; -constexpr rtl::OUStringConstExpr RID_SVXSTR_DASH_DEF[] = +constexpr OUString RID_SVXSTR_DASH_DEF[] = { RID_SVXSTR_DASH0_DEF, RID_SVXSTR_DASH1_DEF, @@ -1271,7 +1271,7 @@ const TranslateId RID_SVXSTR_DASH[] = RID_SVXSTR_DASH30 }; -constexpr rtl::OUStringConstExpr RID_SVXSTR_LEND_DEF[] = +constexpr OUString RID_SVXSTR_LEND_DEF[] = { RID_SVXSTR_LEND0_DEF, RID_SVXSTR_LEND1_DEF, @@ -1343,7 +1343,7 @@ const TranslateId RID_SVXSTR_LEND[] = RID_SVXSTR_LEND31 }; -constexpr rtl::OUStringConstExpr RID_SVXSTR_GRDT_DEF[] = +constexpr OUString RID_SVXSTR_GRDT_DEF[] = { RID_SVXSTR_GRDT0_DEF, RID_SVXSTR_GRDT1_DEF, @@ -1521,7 +1521,7 @@ const TranslateId RID_SVXSTR_GRDT[] = RID_SVXSTR_GRDT84 }; -constexpr rtl::OUStringConstExpr RID_SVXSTR_HATCHS_DEF[] = +constexpr OUString RID_SVXSTR_HATCHS_DEF[] = { RID_SVXSTR_HATCH0_DEF, RID_SVXSTR_HATCH1_DEF, @@ -1561,7 +1561,7 @@ const TranslateId RID_SVXSTR_HATCHS[] = RID_SVXSTR_HATCH15 }; -constexpr rtl::OUStringConstExpr RID_SVXSTR_TRASNGR_DEF[] = +constexpr OUString RID_SVXSTR_TRASNGR_DEF[] = { RID_SVXSTR_TRASNGR0_DEF }; @@ -1571,7 +1571,7 @@ const TranslateId RID_SVXSTR_TRASNGR[] = RID_SVXSTR_TRASNGR0 }; -static bool SvxUnoGetResourceRanges( const sal_uInt16 nWhich, const rtl::OUStringConstExpr*& pApiResIds, const TranslateId*& pIntResIds, int& nCount ) noexcept +static bool SvxUnoGetResourceRanges( const sal_uInt16 nWhich, const OUString*& pApiResIds, const TranslateId*& pIntResIds, int& nCount ) noexcept { switch( nWhich ) { @@ -1618,7 +1618,7 @@ static bool SvxUnoGetResourceRanges( const sal_uInt16 nWhich, const rtl::OUStrin } /// @throws std::exception -static bool SvxUnoConvertResourceStringToApi(const TranslateId* pSourceResIds, const rtl::OUStringConstExpr* pDestResIds, int nCount, OUString& rString) +static bool SvxUnoConvertResourceStringToApi(const TranslateId* pSourceResIds, const OUString* pDestResIds, int nCount, OUString& rString) { // first, calculate the search string length without an optional number after the name sal_Int32 nLength = rString.getLength(); @@ -1651,7 +1651,7 @@ static bool SvxUnoConvertResourceStringToApi(const TranslateId* pSourceResIds, c const OUString & aCompare = SvxResId(pSourceResIds[i]); if( aShortString == aCompare ) { - rString = rString.replaceAt( 0, aShortString.size(), OUString(pDestResIds[i]) ); + rString = rString.replaceAt( 0, aShortString.size(), pDestResIds[i] ); return true; } else if( rString == aCompare ) @@ -1664,7 +1664,7 @@ static bool SvxUnoConvertResourceStringToApi(const TranslateId* pSourceResIds, c return false; } -static bool SvxUnoConvertResourceStringFromApi(const rtl::OUStringConstExpr* pSourceResIds, const TranslateId* pDestResIds, int nCount, OUString& rString) +static bool SvxUnoConvertResourceStringFromApi(const OUString* 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(); @@ -1694,8 +1694,8 @@ static bool SvxUnoConvertResourceStringFromApi(const rtl::OUStringConstExpr* pSo for (int i = 0; i < nCount; ++i) { - auto pCompare = pSourceResIds[i]; - if( aShortString == pCompare.asView() ) + auto const & pCompare = pSourceResIds[i]; + if( aShortString == pCompare ) { rString = rString.replaceAt( 0, aShortString.size(), SvxResId(pDestResIds[i]) ); return true; @@ -1721,7 +1721,7 @@ static bool SvxUnoConvertResourceStringFromApi(const rtl::OUStringConstExpr* pSo // the possibility to define it wrong // - change the compare to also work when a shorter name is in front of a longer one -constexpr rtl::OUStringConstExpr SvxUnoColorNameDefResId[] = +constexpr OUString SvxUnoColorNameDefResId[] = { RID_SVXSTR_COLOR_BLUEGREY_DEF, RID_SVXSTR_COLOR_BLACK_DEF, @@ -1930,7 +1930,7 @@ const TranslateId SvxUnoColorNameResId[] = }; /// @throws std::exception -static bool SvxUnoConvertResourceStringBuiltInToApi(const TranslateId* pSourceResIds, rtl::OUStringConstExpr const *pDestResIds, int nCount, OUString& rString) +static bool SvxUnoConvertResourceStringBuiltInToApi(const TranslateId* pSourceResIds, OUString 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 :-) @@ -1949,7 +1949,7 @@ static bool SvxUnoConvertResourceStringBuiltInToApi(const TranslateId* pSourceRe OUString aStrDefName = SvxResId(pSourceResIds[i]); if( sStr == aStrDefName ) { - OUString aReplace = pDestResIds[i]; + OUString const & aReplace = pDestResIds[i]; rString = rString.replaceAt( 0, aStrDefName.getLength(), aReplace ); return true; } @@ -1958,7 +1958,7 @@ static bool SvxUnoConvertResourceStringBuiltInToApi(const TranslateId* pSourceRe return false; } -static bool SvxUnoConvertResourceStringBuiltInFromApi(rtl::OUStringConstExpr const *pSourceResIds, const TranslateId* pDestResIds, int nCount, OUString& rString) +static bool SvxUnoConvertResourceStringBuiltInFromApi(OUString 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 :-) @@ -1974,10 +1974,10 @@ static bool SvxUnoConvertResourceStringBuiltInFromApi(rtl::OUStringConstExpr con for(int i = 0; i < nCount; ++i ) { - if( sStr == pSourceResIds[i].asView() ) + if( sStr == pSourceResIds[i] ) { OUString aReplace = SvxResId(pDestResIds[i]); - rString = aReplace + rString.subView( pSourceResIds[i].asView().size() ); + rString = aReplace + rString.subView( pSourceResIds[i].getLength() ); return true; } } @@ -2001,7 +2001,7 @@ OUString SvxUnogetApiNameForItem(const sal_uInt16 nWhich, const OUString& rInter } else { - const rtl::OUStringConstExpr* pApiResIds; + const OUString* pApiResIds; const TranslateId* pIntResIds; int nCount; @@ -2034,7 +2034,7 @@ OUString SvxUnogetInternalNameForItem(const sal_uInt16 nWhich, const OUString& r } else { - const rtl::OUStringConstExpr* pApiResIds; + const OUString* pApiResIds; const TranslateId* pIntResIds; int nCount; -- cgit