diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-23 12:34:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-26 13:12:31 +0200 |
commit | 0193b284e880a659ab73160e42238e1d5fe5cf8f (patch) | |
tree | da09299838a6afb43d7c601803a6bab787489854 /sd | |
parent | 2ef138de767c312188d41a7f206234eafac3108b (diff) |
new loplugin:constexprliteral
OUStringLiteral should be declared constexpr, to enforce
that it is initialised at compile-time and not runtime.
This seems to make a different at least on Visual Studio
Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/SVGExportTests.cxx | 2 | ||||
-rw-r--r-- | sd/qa/unit/misc-tests.cxx | 2 | ||||
-rw-r--r-- | sd/source/console/PresenterController.cxx | 6 | ||||
-rw-r--r-- | sd/source/console/PresenterSlideSorter.cxx | 2 | ||||
-rw-r--r-- | sd/source/core/CustomAnimationEffect.cxx | 2 | ||||
-rw-r--r-- | sd/source/filter/grf/sdgrffilter.cxx | 2 | ||||
-rw-r--r-- | sd/source/filter/xml/sdxmlwrp.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationDialog.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationList.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationPane.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel3.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/framework/configuration/ConfigurationTracer.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/DocumentRenderer.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsf.cxx | 8 |
17 files changed, 31 insertions, 31 deletions
diff --git a/sd/qa/unit/SVGExportTests.cxx b/sd/qa/unit/SVGExportTests.cxx index a8d64e828a67..c300bb03527e 100644 --- a/sd/qa/unit/SVGExportTests.cxx +++ b/sd/qa/unit/SVGExportTests.cxx @@ -263,7 +263,7 @@ public: void testSVGPlaceholderLocale() { - static const OUStringLiteral aLangISO(u"it-IT"); + static constexpr OUStringLiteral aLangISO(u"it-IT"); SvtSysLocaleOptions aSysLocaleOptions; aSysLocaleOptions.SetLocaleConfigString(aLangISO); aSysLocaleOptions.SetUILocaleConfigString(aLangISO); diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index 485feb5bbbd8..b0dedac84636 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -831,7 +831,7 @@ void SdMiscTest::testTdf129898LayerDrawnInSlideshow() SdDrawDocument* pDoc = pXImpressDocument->GetDoc(); // Verify model - static const OUStringLiteral sName = u"DrawnInSlideshow"; + static constexpr OUStringLiteral sName = u"DrawnInSlideshow"; SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); SdrLayer* pLayer = rLayerAdmin.GetLayer(sName); CPPUNIT_ASSERT_MESSAGE("No layer DrawnInSlideshow", pLayer); diff --git a/sd/source/console/PresenterController.cxx b/sd/source/console/PresenterController.cxx index 39ed5506960d..2a0e6d25aa47 100644 --- a/sd/source/console/PresenterController.cxx +++ b/sd/source/console/PresenterController.cxx @@ -303,9 +303,9 @@ void PresenterController::UpdatePaneTitles() return; // Get placeholders and their values. - static const OUStringLiteral sCurrentSlideNumberPlaceholder (u"CURRENT_SLIDE_NUMBER"); - static const OUStringLiteral sCurrentSlideNamePlaceholder (u"CURRENT_SLIDE_NAME"); - static const OUStringLiteral sSlideCountPlaceholder (u"SLIDE_COUNT"); + static constexpr OUStringLiteral sCurrentSlideNumberPlaceholder (u"CURRENT_SLIDE_NUMBER"); + static constexpr OUStringLiteral sCurrentSlideNamePlaceholder (u"CURRENT_SLIDE_NAME"); + static constexpr OUStringLiteral sSlideCountPlaceholder (u"SLIDE_COUNT"); // Get string for slide count. OUString sSlideCount ("---"); diff --git a/sd/source/console/PresenterSlideSorter.cxx b/sd/source/console/PresenterSlideSorter.cxx index 911452036660..85d7831b165d 100644 --- a/sd/source/console/PresenterSlideSorter.cxx +++ b/sd/source/console/PresenterSlideSorter.cxx @@ -1583,7 +1583,7 @@ OUString PresenterSlideSorter::MouseOverManager::GetFittingText ( double nBestWidth (0); OUString sBestCandidate; sal_Int32 nLength (round(rsText.getLength() * nMaximalWidth / nTextWidth)); - static const OUStringLiteral sEllipses (u"..."); + static constexpr OUStringLiteral sEllipses (u"..."); while (true) { const OUString sCandidate (rsText.subView(0,nLength) + sEllipses); diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index b74179dfb1f7..f041d0e1e45b 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -307,7 +307,7 @@ sal_Int32 CustomAnimationEffect::getNumberOfSubitems( const Any& aTarget, sal_In Reference< XEnumerationAccess > xEA( xShape, UNO_QUERY_THROW ); Reference< XEnumeration > xEnumeration( xEA->createEnumeration(), UNO_SET_THROW ); css::lang::Locale aLocale; - static const OUStringLiteral aStrLocaleName( u"CharLocale" ); + static constexpr OUStringLiteral aStrLocaleName( u"CharLocale" ); Reference< XTextRange > xParagraph; sal_Int32 nPara = 0; diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 693f297a19c6..4866b269f776 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -264,7 +264,7 @@ bool SdGRFFilter::Export() beans::PropertyValues aArgs; TransformItems( SID_SAVEASDOC, *pSet, aArgs ); - static const OUStringLiteral sFilterName( u"FilterName" ); + static constexpr OUStringLiteral sFilterName( u"FilterName" ); OUString sShortName( rGraphicFilter.GetExportFormatShortName( nFilter ) ); bool bFilterNameFound = false; diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index 43c3d0d7766d..f1c2d9d29ffa 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -676,7 +676,7 @@ bool SdXMLFilter::Import( ErrCode& nError ) if( xModelSet.is() ) { uno::Reference< beans::XPropertySetInfo > xModelSetInfo( xModelSet->getPropertySetInfo() ); - static const OUStringLiteral sPropName( u"BuildId" ); + static constexpr OUStringLiteral sPropName( u"BuildId" ); OUString sBuildId; xInfoSet->getPropertyValue(sPropName) >>= sBuildId; diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index e12e6ea123e7..1b4df937ae27 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -1570,7 +1570,7 @@ CustomAnimationDurationTabPage::CustomAnimationDurationTabPage(weld::Container* if( !xCurrentPage.is() ) return; - static const OUStringLiteral aStrIsEmptyPresObj( u"IsEmptyPresentationObject" ); + static constexpr OUStringLiteral aStrIsEmptyPresObj( u"IsEmptyPresentationObject" ); sal_Int32 nShape, nCount = xCurrentPage->getCount(); for( nShape = 0; nShape < nCount; nShape++ ) diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index 0128f210eb77..78f3f1203e27 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -134,13 +134,13 @@ OUString getShapeDescription( const Reference< XShape >& xShape, bool bWithText Reference<XPropertySetInfo> xInfo(xSet->getPropertySetInfo()); if (xInfo.is()) { - static const OUStringLiteral aPropName1(u"Name"); + static constexpr OUStringLiteral aPropName1(u"Name"); if(xInfo->hasPropertyByName(aPropName1)) xSet->getPropertyValue(aPropName1) >>= aDescription; bAppendIndex = aDescription.isEmpty(); - static const OUStringLiteral aPropName2(u"UINameSingular"); + static constexpr OUStringLiteral aPropName2(u"UINameSingular"); if(xInfo->hasPropertyByName(aPropName2)) xSet->getPropertyValue(aPropName2) >>= aDescription; } diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 2276fa91b3aa..bcec46b33ebd 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -944,7 +944,7 @@ Any CustomAnimationPane::getProperty1Value( sal_Int32 nType, const CustomAnimati case nPropertyTypeCharHeight: { - static const OUStringLiteral aAttributeName( u"CharHeight" ); + static constexpr OUStringLiteral aAttributeName( u"CharHeight" ); Any aValue( pEffect->getProperty( AnimationNodeType::SET, aAttributeName, EValue::To ) ); if( !aValue.hasValue() ) aValue = pEffect->getProperty( AnimationNodeType::ANIMATE, aAttributeName, EValue::To ); @@ -1017,7 +1017,7 @@ bool CustomAnimationPane::setProperty1Value( sal_Int32 nType, const CustomAnimat case nPropertyTypeCharHeight: { - static const OUStringLiteral aAttributeName( u"CharHeight" ); + static constexpr OUStringLiteral aAttributeName( u"CharHeight" ); bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, aAttributeName, EValue::To, rValue ); if( !bEffectChanged ) bEffectChanged = pEffect->setProperty( AnimationNodeType::ANIMATE, aAttributeName, EValue::To, rValue ); diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index be045818a67a..19ae6796841c 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -298,9 +298,9 @@ void DrawDocShell::Execute( SfxRequest& rReq ) // setting the new language... if (!aNewLangTxt.isEmpty()) { - static const OUStringLiteral aSelectionLangPrefix(u"Current_"); - static const OUStringLiteral aParagraphLangPrefix(u"Paragraph_"); - static const OUStringLiteral aDocumentLangPrefix(u"Default_"); + static constexpr OUStringLiteral aSelectionLangPrefix(u"Current_"); + static constexpr OUStringLiteral aParagraphLangPrefix(u"Paragraph_"); + static constexpr OUStringLiteral aDocumentLangPrefix(u"Default_"); bool bSelection = false; bool bParagraph = false; @@ -407,7 +407,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) if (pItem2) sApplyText = pItem2->GetValue(); - static const OUStringLiteral sSpellingRule(u"Spelling_"); + static constexpr OUStringLiteral sSpellingRule(u"Spelling_"); sal_Int32 nPos = 0; if(-1 != (nPos = sApplyText.indexOf( sSpellingRule ))) { diff --git a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx index 00ddd5ff1b39..68cc9fe9a10b 100644 --- a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx @@ -56,7 +56,7 @@ void ConfigurationTracer::TraceBoundResources ( { const Sequence<Reference<XResourceId> > aResourceList ( rxConfiguration->getResources(rxResourceId, OUString(), AnchorBindingMode_DIRECT)); - static const OUStringLiteral sIndentation (u" "); + static constexpr OUStringLiteral sIndentation (u" "); for (Reference<XResourceId> const & resourceId : aResourceList) { OUString sLine (resourceId->getResourceURL()); diff --git a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx index 8e3fcff143a4..be339116f6c3 100644 --- a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx +++ b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx @@ -115,8 +115,8 @@ void RecentlyUsedMasterPages::LoadPersistentValues() if ( ! xSet.is()) return; - static const OUStringLiteral sURLMemberName(u"URL"); - static const OUStringLiteral sNameMemberName(u"Name"); + static constexpr OUStringLiteral sURLMemberName(u"URL"); + static constexpr OUStringLiteral sNameMemberName(u"Name"); OUString sURL; OUString sName; @@ -183,8 +183,8 @@ void RecentlyUsedMasterPages::SavePersistentValues() xSet->removeByName (rKey); // Fill it with the URLs of this object. - static const OUStringLiteral sURLMemberName(u"URL"); - static const OUStringLiteral sNameMemberName(u"Name"); + static constexpr OUStringLiteral sURLMemberName(u"URL"); + static constexpr OUStringLiteral sNameMemberName(u"Name"); Any aValue; Reference<lang::XSingleServiceFactory> xChildFactory ( xSet, UNO_QUERY); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 1f2f76d11d1b..9e9845c3c3cd 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2014,8 +2014,8 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r // exporting transition effects to pdf if ( mbImpressDoc && !pPDFExtOutDevData->GetIsExportNotesPages() && pPDFExtOutDevData->GetIsExportTransitionEffects() ) { - static const OUStringLiteral sEffect( u"Effect" ); - static const OUStringLiteral sSpeed ( u"Speed" ); + static constexpr OUStringLiteral sEffect( u"Effect" ); + static constexpr OUStringLiteral sSpeed ( u"Speed" ); sal_Int32 nTime = 800; presentation::AnimationSpeed aAs; if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) ) diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 8e55d1f1ab99..ee95c853d37c 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -399,7 +399,7 @@ rtl::Reference<SdrObject> SdGenericDrawPage::CreateSdrObject_( const Reference< return nullptr; OUString aType( xShape->getShapeType() ); - static const OUStringLiteral aPrefix( u"com.sun.star.presentation." ); + static constexpr OUStringLiteral aPrefix( u"com.sun.star.presentation." ); if( !aType.startsWith( aPrefix ) ) { return SvxFmDrawPage::CreateSdrObject_( xShape ); diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 7ca62d9daa1b..fb7cec583aff 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -965,7 +965,7 @@ namespace { SdPage& rHandoutPage (*rDocument.GetSdPage(0, PageKind::Handout)); Reference< css::beans::XPropertySet > xHandoutPage( rHandoutPage.getUnoPage(), UNO_QUERY ); - static const OUStringLiteral sPageNumber( u"Number" ); + static constexpr OUStringLiteral sPageNumber( u"Number" ); // Collect the page objects of the handout master. std::vector<SdrPageObj*> aHandoutPageObjects; diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index e74fe71dd45e..08d75842a187 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -121,13 +121,13 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet) uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_SET_THROW ); form::FormButtonType eButtonType = form::FormButtonType_URL; - static const OUStringLiteral sButtonType( u"ButtonType" ); + static constexpr OUStringLiteral sButtonType( u"ButtonType" ); if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) ) { OUString aString; // Label - static const OUStringLiteral sLabel( u"Label" ); + static constexpr OUStringLiteral sLabel( u"Label" ); if(xPropInfo->hasPropertyByName(sLabel)) { if( xPropSet->getPropertyValue(sLabel) >>= aString ) @@ -135,7 +135,7 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet) } // URL - static const OUStringLiteral sTargetURL( u"TargetURL" ); + static constexpr OUStringLiteral sTargetURL( u"TargetURL" ); if(xPropInfo->hasPropertyByName(sTargetURL)) { if( xPropSet->getPropertyValue(sTargetURL) >>= aString ) @@ -143,7 +143,7 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet) } // Target - static const OUStringLiteral sTargetFrame( u"TargetFrame" ); + static constexpr OUStringLiteral sTargetFrame( u"TargetFrame" ); if(xPropInfo->hasPropertyByName(sTargetFrame) ) { if( xPropSet->getPropertyValue(sTargetFrame) >>= aString ) |