diff options
author | Noel Grandin <noel@peralex.com> | 2016-07-21 14:23:23 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-08-16 06:30:09 +0000 |
commit | 127f70d66ac32b7a4ec818adaf1bdccb71865ee5 (patch) | |
tree | a020d2002c2eea81484297421f0fbe3ee84c2db0 | |
parent | ce95e39f8e952159844e9dc04a1df402bb103634 (diff) |
new loplugin to check for static OUStrings
that are better declared as OUStringLiteral
Change-Id: Ifb5d9a12bb31a68641940bec16971a8181a46567
Reviewed-on: https://gerrit.libreoffice.org/27377
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
33 files changed, 373 insertions, 285 deletions
diff --git a/chart2/qa/extras/chart2_trendcalculators.cxx b/chart2/qa/extras/chart2_trendcalculators.cxx index ca327f1e2c94..738a6d6bfca4 100644 --- a/chart2/qa/extras/chart2_trendcalculators.cxx +++ b/chart2/qa/extras/chart2_trendcalculators.cxx @@ -136,7 +136,7 @@ void Chart2TrendCalculators::testPotentialRegression2() xValues[i] = d; yValues[i] = -2.0 * pow ( d, 3 ); } - checkCalculator( xValues, yValues, "f(x) = "+ aMinusSign +" 2 x^3"); + checkCalculator( xValues, yValues, "f(x) = "+ OUString(aMinusSign) +" 2 x^3"); } // test y = - 2 X - 5 @@ -152,7 +152,7 @@ void Chart2TrendCalculators::testLinearRegression1() xValues[i] = d; yValues[i] = - 2.0 * d - 5.0 ; } - checkCalculator( xValues, yValues, "f(x) = "+ aMinusSign +" 2x "+ aMinusSign +" 5"); + checkCalculator( xValues, yValues, "f(x) = "+ OUString(aMinusSign) +" 2x "+ OUString(aMinusSign) +" 5"); } // test y = A x ^ B @@ -168,7 +168,7 @@ void Chart2TrendCalculators::testPolynomialRegression1() xValues[i] = d; yValues[i] = - 2.0 * d * d + 4 * d - 5; } - OUString sExpectedFormula( "f(x) = "+ aMinusSign +" 2x" + OUString( aSuperscriptFigures[2] ) + " + 4x "+ aMinusSign +" 5" ); + OUString sExpectedFormula( "f(x) = "+ OUString(aMinusSign) +" 2x" + OUString( aSuperscriptFigures[2] ) + " + 4x "+ OUString(aMinusSign) +" 5" ); checkCalculator( xValues, yValues, sExpectedFormula ); } @@ -199,7 +199,7 @@ void Chart2TrendCalculators::testExponentialRegression2() xValues[i] = d; yValues[i] = -2.0 * exp ( 0.3 * d ); } - checkCalculator( xValues, yValues, "f(x) = "+ aMinusSign + " 2 exp( 0.3 x )"); + checkCalculator( xValues, yValues, "f(x) = "+ OUString(aMinusSign) + " 2 exp( 0.3 x )"); } diff --git a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx index 3c19a3e2804e..3282f2dc1abc 100644 --- a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx +++ b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx @@ -176,7 +176,7 @@ OUString PotentialRegressionCurveCalculator::ImplGetRepresentation( // if nValueLength not calculated then nullptr sal_Int32* pValueLength = nValueLength ? &nValueLength : nullptr; if ( m_fIntercept < 0.0 ) // add intercept value - aTmpBuf.append( aMinusSign+" " ); + aTmpBuf.append( aMinusSign+" " ); if( bHasIntercept ) { OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fIntercept), pValueLength ); diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index 1e62e8368416..fd391186c137 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -989,7 +989,7 @@ bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < embed // the media type will be provided with object insertion OUString aOrigStorMediaType; uno::Reference< beans::XPropertySet > xStorProps( pImpl->mxStorage, uno::UNO_QUERY_THROW ); - static const OUString s_sMediaType("MediaType"); + static const OUStringLiteral s_sMediaType("MediaType"); xStorProps->getPropertyValue( s_sMediaType ) >>= aOrigStorMediaType; SAL_WARN_IF( aOrigStorMediaType.isEmpty(), "comphelper.container", "No valuable media type in the storage!\n" ); diff --git a/compilerplugins/clang/stringstatic.cxx b/compilerplugins/clang/stringstatic.cxx new file mode 100644 index 000000000000..ec7b3b0ad527 --- /dev/null +++ b/compilerplugins/clang/stringstatic.cxx @@ -0,0 +1,140 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "check.hxx" +#include "plugin.hxx" + +/** Look for static OUString and OUString[], they can be more effeciently declared as: + + static const OUStringLiteral our_aLBEntryMap[] = { + OUStringLiteral(" "), + OUStringLiteral(", ")}; + static const OUStringLiteral sName("name"); + + which is more efficient at startup time. + */ +namespace { + +class StringStatic + : public clang::RecursiveASTVisitor<StringStatic> + , public loplugin::Plugin +{ + +public: + explicit StringStatic(InstantiationData const& rData) : Plugin(rData) {} + + void run() override; + bool VisitVarDecl(VarDecl const*); + bool VisitReturnStmt(ReturnStmt const*); +private: + std::set<VarDecl const *> potentialVars; + std::set<VarDecl const *> excludeVars; +}; + +void StringStatic::run() +{ + StringRef fn( compiler.getSourceManager().getFileEntryForID( + compiler.getSourceManager().getMainFileID())->getName() ); + // passing around pointers to global OUString + if (fn.startswith(SRCDIR "/filter/source/svg/")) + return; + // has a mix of literals and and refs to external OUStrings + if (fn == SRCDIR "/ucb/source/ucp/webdav-neon/ContentProperties.cxx") + return; + // we could use OUStringLiteral1 here, but we'd need to update OUStringLiteral1 to allow BMP chars first + if (fn == SRCDIR "/include/chart2/SpecialUnicodes.hxx") + return; + + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + + for (auto const & pVarDecl : excludeVars) { + potentialVars.erase(pVarDecl); + } + for (auto const & varDecl : potentialVars) { + report(DiagnosticsEngine::Warning, + "rather declare this using OUStringLiteral or char[]", + varDecl->getLocation()) + << varDecl->getSourceRange(); + } +} + +bool StringStatic::VisitVarDecl(VarDecl const* varDecl) +{ + if (ignoreLocation(varDecl)) { + return true; + } + + QualType qt = varDecl->getType(); + if (!varDecl->hasGlobalStorage() + || !varDecl->isThisDeclarationADefinition() + || !qt.isConstQualified()) { + return true; + } + if (qt->isArrayType()) { + qt = qt->getAsArrayTypeUnsafe()->getElementType(); + } + if (!loplugin::TypeCheck(qt).Class("OUString").Namespace("rtl").GlobalNamespace()) { + return true; + } + if (varDecl->hasInit()) { + Expr const * expr = varDecl->getInit(); + while (true) { + if (ExprWithCleanups const * exprWithCleanups = dyn_cast<ExprWithCleanups>(expr)) { + expr = exprWithCleanups->getSubExpr(); + } + else if (CastExpr const * castExpr = dyn_cast<CastExpr>(expr)) { + expr = castExpr->getSubExpr(); + } + else if (MaterializeTemporaryExpr const * materializeExpr = dyn_cast<MaterializeTemporaryExpr>(expr)) { + expr = materializeExpr->GetTemporaryExpr(); + } + else if (CXXBindTemporaryExpr const * bindExpr = dyn_cast<CXXBindTemporaryExpr>(expr)) { + expr = bindExpr->getSubExpr(); + } + else if (CXXConstructExpr const * constructExpr = dyn_cast<CXXConstructExpr>(expr)) { + if (constructExpr->getNumArgs() != 1) { + return true; + } + expr = constructExpr->getArg(0); + } else if (isa<CallExpr>(expr)) { + return true; + } else { + break; + } + } + } + potentialVars.insert(varDecl); + + return true; +} + +bool StringStatic::VisitReturnStmt(ReturnStmt const * returnStmt) +{ + if (ignoreLocation(returnStmt)) { + return true; + } + if (!returnStmt->getRetValue()) { + return true; + } + DeclRefExpr const * declRef = dyn_cast<DeclRefExpr>(returnStmt->getRetValue()); + if (!declRef) { + return true; + } + VarDecl const * varDecl = dyn_cast<VarDecl>(declRef->getDecl()); + if (varDecl) { + excludeVars.insert(varDecl); + } + return true; +} + +loplugin::Plugin::Registration<StringStatic> X("stringstatic"); + +} // namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index cc3f874b107b..cae94275f944 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -460,10 +460,7 @@ void OCalcTable::fillColumns() switch ( eType ) { case DataType::VARCHAR: - { - static const OUString s_sType("VARCHAR"); - aTypeName = s_sType; - } + aTypeName = "VARCHAR"; break; case DataType::DECIMAL: aTypeName = "DECIMAL"; diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx index 33cc2c5cc866..ad843c4ae012 100644 --- a/connectivity/source/drivers/firebird/Connection.cxx +++ b/connectivity/source/drivers/firebird/Connection.cxx @@ -75,7 +75,11 @@ using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::uno; -const OUString Connection::our_sDBLocation( "firebird.fdb" ); +/** + * Location within the .odb that an embedded .fdb will be stored. + * Only relevant for embedded dbs. + */ +static const OUStringLiteral our_sDBLocation( "firebird.fdb" ); Connection::Connection(FirebirdDriver* _pDriver) : Connection_BASE(m_aMutex) diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx index b1dd5f307e55..aad55e9fb94d 100644 --- a/connectivity/source/drivers/firebird/Connection.hxx +++ b/connectivity/source/drivers/firebird/Connection.hxx @@ -71,12 +71,6 @@ namespace connectivity { friend class connectivity::OSubComponent<Connection, Connection_BASE>; - /** - * Location within the .odb that an embedded .fdb will be stored. - * Only relevant for embedded dbs. - */ - static const OUString our_sDBLocation; - ::osl::Mutex m_aMutex; TTypeInfoVector m_aTypeInfo; // vector containing an entry diff --git a/connectivity/source/drivers/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx index 6b87abe714e0..ab83b502fd6f 100644 --- a/connectivity/source/drivers/firebird/Driver.cxx +++ b/connectivity/source/drivers/firebird/Driver.cxx @@ -57,10 +57,12 @@ namespace connectivity } } -// Static const member variables -const OUString FirebirdDriver::our_sFirebirdTmpVar("FIREBIRD_TMP"); -const OUString FirebirdDriver::our_sFirebirdLockVar("FIREBIRD_LOCK"); -const OUString FirebirdDriver::our_sFirebirdMsgVar("FIREBIRD_MSG"); +// Static const variables +namespace { +const char our_sFirebirdTmpVar[] = "FIREBIRD_TMP"; +const char our_sFirebirdLockVar[] = "FIREBIRD_LOCK"; +const char our_sFirebirdMsgVar[] = "FIREBIRD_MSG"; +}; FirebirdDriver::FirebirdDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext) : ODriver_BASE(m_aMutex) @@ -79,10 +81,10 @@ FirebirdDriver::FirebirdDriver(const css::uno::Reference< css::uno::XComponentCo // we can create directories for firebird at will. // Overrides firebird's default of /tmp or c:\temp - osl_setEnvironment(our_sFirebirdTmpVar.pData, m_firebirdTMPDirectory.GetFileName().pData); + osl_setEnvironment(OUString(our_sFirebirdTmpVar).pData, m_firebirdTMPDirectory.GetFileName().pData); // Overrides firebird's default of /tmp/firebird or c:\temp\firebird - osl_setEnvironment(our_sFirebirdLockVar.pData, m_firebirdLockDirectory.GetFileName().pData); + osl_setEnvironment(OUString(our_sFirebirdLockVar).pData, m_firebirdLockDirectory.GetFileName().pData); #ifndef SYSTEM_FIREBIRD // Overrides firebird's hardcoded default of /usr/local/firebird on *nix, @@ -91,7 +93,7 @@ FirebirdDriver::FirebirdDriver(const css::uno::Reference< css::uno::XComponentCo ::rtl::Bootstrap::expandMacros(sMsgURL); OUString sMsgPath; ::osl::FileBase::getSystemPathFromFileURL(sMsgURL, sMsgPath); - osl_setEnvironment(our_sFirebirdMsgVar.pData, sMsgPath.pData); + osl_setEnvironment(OUString(our_sFirebirdMsgVar).pData, sMsgPath.pData); #endif } @@ -113,11 +115,11 @@ void FirebirdDriver::disposing() } m_xConnections.clear(); - osl_clearEnvironment(our_sFirebirdTmpVar.pData); - osl_clearEnvironment(our_sFirebirdLockVar.pData); + osl_clearEnvironment(OUString(our_sFirebirdTmpVar).pData); + osl_clearEnvironment(OUString(our_sFirebirdLockVar).pData); #ifndef SYSTEM_FIREBIRD - osl_clearEnvironment(our_sFirebirdMsgVar.pData); + osl_clearEnvironment(OUString(our_sFirebirdMsgVar).pData); #endif OSL_VERIFY(fb_shutdown(0, 1)); diff --git a/connectivity/source/drivers/firebird/Driver.hxx b/connectivity/source/drivers/firebird/Driver.hxx index 64eeb53839c6..e3ce787755b0 100644 --- a/connectivity/source/drivers/firebird/Driver.hxx +++ b/connectivity/source/drivers/firebird/Driver.hxx @@ -47,10 +47,6 @@ namespace connectivity class FirebirdDriver : public ODriver_BASE { private: - static const ::rtl::OUString our_sFirebirdTmpVar; - static const ::rtl::OUString our_sFirebirdLockVar; - static const ::rtl::OUString our_sFirebirdMsgVar; - css::uno::Reference<css::uno::XComponentContext> m_aContext; ::utl::TempFile m_firebirdTMPDirectory; ::utl::TempFile m_firebirdLockDirectory; diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx index 4b6ab474c5a8..e76c2370474d 100644 --- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -431,14 +431,14 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges( { // here we know that the count of column doesn't match ::std::map<sal_Int32,sal_Int32> aColumnMatching; - static const OUString sPrivs[] = { - OUString("TABLE_CAT"), - OUString("TABLE_SCHEM"), - OUString("TABLE_NAME"), - OUString("GRANTOR"), - OUString("GRANTEE"), - OUString("PRIVILEGE"), - OUString("IS_GRANTABLE") + static const OUStringLiteral sPrivs[] = { + OUStringLiteral("TABLE_CAT"), + OUStringLiteral("TABLE_SCHEM"), + OUStringLiteral("TABLE_NAME"), + OUStringLiteral("GRANTOR"), + OUStringLiteral("GRANTEE"), + OUStringLiteral("PRIVILEGE"), + OUStringLiteral("IS_GRANTABLE") }; OUString sColumnName; diff --git a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx index db1b65a6e22f..44a4c0cf934b 100644 --- a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx +++ b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx @@ -837,10 +837,10 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException, std::exception) { // there exists no possibility to get table types so we have to check - static const OUString sTableTypes[] = + static const OUStringLiteral sTableTypes[] = { - OUString("TABLE"), - OUString("VIEW") + OUStringLiteral("TABLE"), + OUStringLiteral("VIEW") // Currently we only support a 'TABLE' and 'VIEW' nothing more complex // OUString("SYSTEM TABLE"), @@ -858,7 +858,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLE { ODatabaseMetaDataResultSet::ORow aRow; aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(sTableType)); + aRow.push_back(new ORowSetValueDecorator(OUString(sTableType))); // bound row aRows.push_back(aRow); } diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index a97db75d6f94..d55343983933 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -581,28 +581,19 @@ ConvertSvxConfigEntry( const uno::Reference< container::XNameAccess >& xCommandToLabelMap, const SvxConfigEntry* pEntry ) { - static const OUString aDescriptorCommandURL ( - ITEM_DESCRIPTOR_COMMANDURL ); - - static const OUString aDescriptorType( - ITEM_DESCRIPTOR_TYPE ); - - static const OUString aDescriptorLabel( - ITEM_DESCRIPTOR_LABEL ); - uno::Sequence< beans::PropertyValue > aPropSeq( 3 ); - aPropSeq[0].Name = aDescriptorCommandURL; + aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL; aPropSeq[0].Value <<= OUString( pEntry->GetCommand() ); - aPropSeq[1].Name = aDescriptorType; + aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE; aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT; // If the name has not been changed and the name is the same as // in the default command to label map then the label can be stored // as an empty string. // It will be initialised again later using the command to label map. - aPropSeq[2].Name = aDescriptorLabel; + aPropSeq[2].Name = ITEM_DESCRIPTOR_LABEL; if ( !pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty() ) { bool isDefaultName = false; @@ -614,7 +605,7 @@ ConvertSvxConfigEntry( { for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); ++i ) { - if ( tmpPropSeq[i].Name.equals( aDescriptorLabel ) ) + if ( tmpPropSeq[i].Name == ITEM_DESCRIPTOR_LABEL ) { OUString tmpLabel; tmpPropSeq[i].Value >>= tmpLabel; @@ -656,31 +647,19 @@ ConvertToolbarEntry( const uno::Reference< container::XNameAccess >& xCommandToLabelMap, const SvxConfigEntry* pEntry ) { - static const OUString aDescriptorCommandURL ( - ITEM_DESCRIPTOR_COMMANDURL ); - - static const OUString aDescriptorType( - ITEM_DESCRIPTOR_TYPE ); - - static const OUString aDescriptorLabel( - ITEM_DESCRIPTOR_LABEL ); - - static const OUString aIsVisible( - ITEM_DESCRIPTOR_ISVISIBLE ); - uno::Sequence< beans::PropertyValue > aPropSeq( 4 ); - aPropSeq[0].Name = aDescriptorCommandURL; + aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL; aPropSeq[0].Value <<= OUString( pEntry->GetCommand() ); - aPropSeq[1].Name = aDescriptorType; + aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE; aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT; // If the name has not been changed and the name is the same as // in the default command to label map then the label can be stored // as an empty string. // It will be initialised again later using the command to label map. - aPropSeq[2].Name = aDescriptorLabel; + aPropSeq[2].Name = ITEM_DESCRIPTOR_LABEL; if ( !pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty() ) { bool isDefaultName = false; @@ -692,7 +671,7 @@ ConvertToolbarEntry( { for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); ++i ) { - if ( tmpPropSeq[i].Name.equals( aDescriptorLabel ) ) + if ( tmpPropSeq[i].Name == ITEM_DESCRIPTOR_LABEL ) { OUString tmpLabel; tmpPropSeq[i].Value >>= tmpLabel; @@ -726,7 +705,7 @@ ConvertToolbarEntry( aPropSeq[2].Value <<= OUString( pEntry->GetName() ); } - aPropSeq[3].Name = aIsVisible; + aPropSeq[3].Name = ITEM_DESCRIPTOR_ISVISIBLE; aPropSeq[3].Value <<= pEntry->IsVisible(); return aPropSeq; diff --git a/include/vcl/IconThemeInfo.hxx b/include/vcl/IconThemeInfo.hxx index f1f2fa99e4f7..dbe130272ed3 100644 --- a/include/vcl/IconThemeInfo.hxx +++ b/include/vcl/IconThemeInfo.hxx @@ -30,7 +30,7 @@ class VCL_DLLPUBLIC IconThemeInfo { public: /** The name of the icon theme to use for high contrast mode */ - static const OUString HIGH_CONTRAST_ID; + static const OUStringLiteral HIGH_CONTRAST_ID; /** Construct an IconThemeInfo from the URL to a file. * This method will throw a std::runtime_error if the URL cannot be properly parsed. diff --git a/include/vcl/IconThemeSelector.hxx b/include/vcl/IconThemeSelector.hxx index 990e3ec3fa30..70b000bbdc2e 100644 --- a/include/vcl/IconThemeSelector.hxx +++ b/include/vcl/IconThemeSelector.hxx @@ -77,8 +77,7 @@ private: ReturnFallback(const std::vector<IconThemeInfo>& installedThemes); /** The name of the icon theme which is used as fallback */ - static const OUString - FALLBACK_ICON_THEME_ID; + static const OUStringLiteral FALLBACK_ICON_THEME_ID; static OUString diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx index 05a9b5f7cefb..30f8278f6c2d 100644 --- a/l10ntools/source/xmlparse.cxx +++ b/l10ntools/source/xmlparse.cxx @@ -1099,11 +1099,7 @@ OString XMLUtil::QuotHTML( const OString &rString ) UErrorCode nIcuErr = U_ZERO_ERROR; static const sal_uInt32 nSearchFlags = UREGEX_DOTALL | UREGEX_CASE_INSENSITIVE; - static const OUString sPattern( - "<[/]\?\?[a-z_-]+?(?:| +[a-z]+?=\".*?\") *[/]\?\?>"); - static const UnicodeString sSearchPat( - reinterpret_cast<const UChar*>(sPattern.getStr()), - sPattern.getLength() ); + static const UnicodeString sSearchPat( "<[/]\?\?[a-z_-]+?(?:| +[a-z]+?=\".*?\") *[/]\?\?>" ); const OUString sOUSource = OStringToOUString(rString, RTL_TEXTENCODING_UTF8); icu::UnicodeString sSource( diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 141338d2ad88..f2a686d10102 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -2195,27 +2195,27 @@ uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstance( co uno::Sequence< OUString > SAL_CALL OReportDefinition::getAvailableServiceNames() throw( uno::RuntimeException, std::exception ) { - static const OUString aSvxComponentServiceNameList[] = - { - OUString("com.sun.star.form.component.FixedText"), - OUString("com.sun.star.form.component.DatabaseImageControl"), - OUString("com.sun.star.style.PageStyle"), - OUString("com.sun.star.style.GraphicStyle"), - OUString("com.sun.star.style.FrameStyle"), - OUString("com.sun.star.drawing.Defaults"), - OUString("com.sun.star.document.ImportEmbeddedObjectResolver"), - OUString("com.sun.star.document.ExportEmbeddedObjectResolver"), - OUString("com.sun.star.document.ImportGraphicObjectResolver"), - OUString("com.sun.star.document.ExportGraphicObjectResolver"), - OUString("com.sun.star.chart2.data.DataProvider"), - OUString("com.sun.star.xml.NamespaceMap"), - OUString("com.sun.star.document.Settings"), - OUString("com.sun.star.drawing.GradientTable"), - OUString("com.sun.star.drawing.HatchTable"), - OUString("com.sun.star.drawing.BitmapTable"), - OUString("com.sun.star.drawing.TransparencyGradientTable"), - OUString("com.sun.star.drawing.DashTable"), - OUString("com.sun.star.drawing.MarkerTable") + static const OUStringLiteral aSvxComponentServiceNameList[] = + { + OUStringLiteral("com.sun.star.form.component.FixedText"), + OUStringLiteral("com.sun.star.form.component.DatabaseImageControl"), + OUStringLiteral("com.sun.star.style.PageStyle"), + OUStringLiteral("com.sun.star.style.GraphicStyle"), + OUStringLiteral("com.sun.star.style.FrameStyle"), + OUStringLiteral("com.sun.star.drawing.Defaults"), + OUStringLiteral("com.sun.star.document.ImportEmbeddedObjectResolver"), + OUStringLiteral("com.sun.star.document.ExportEmbeddedObjectResolver"), + OUStringLiteral("com.sun.star.document.ImportGraphicObjectResolver"), + OUStringLiteral("com.sun.star.document.ExportGraphicObjectResolver"), + OUStringLiteral("com.sun.star.chart2.data.DataProvider"), + OUStringLiteral("com.sun.star.xml.NamespaceMap"), + OUStringLiteral("com.sun.star.document.Settings"), + OUStringLiteral("com.sun.star.drawing.GradientTable"), + OUStringLiteral("com.sun.star.drawing.HatchTable"), + OUStringLiteral("com.sun.star.drawing.BitmapTable"), + OUStringLiteral("com.sun.star.drawing.TransparencyGradientTable"), + OUStringLiteral("com.sun.star.drawing.DashTable"), + OUStringLiteral("com.sun.star.drawing.MarkerTable") }; static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList); diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx index 0d4dff5affbb..6349cb0e66dd 100644 --- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx +++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx @@ -366,15 +366,15 @@ uno::Sequence< beans::Property > SAL_CALL DataProviderHandler::getSupportedPrope { rptui::OPropertyInfoService::getExcludeProperties( aNewProps, m_xFormComponentHandler ); beans::Property aValue; - static const OUString s_pProperties[] = + static const OUStringLiteral s_pProperties[] = { - OUString(PROPERTY_CHARTTYPE) - ,OUString(PROPERTY_MASTERFIELDS) - ,OUString(PROPERTY_DETAILFIELDS) - ,OUString(PROPERTY_PREVIEW_COUNT) + OUStringLiteral(PROPERTY_CHARTTYPE) + ,OUStringLiteral(PROPERTY_MASTERFIELDS) + ,OUStringLiteral(PROPERTY_DETAILFIELDS) + ,OUStringLiteral(PROPERTY_PREVIEW_COUNT) }; - for (const OUString & rName : s_pProperties) + for (const auto & rName : s_pProperties) { aValue.Name = rName; aNewProps.push_back(aValue); diff --git a/reportdesign/source/ui/inspection/metadata.cxx b/reportdesign/source/ui/inspection/metadata.cxx index e9882d71937e..480e19c83d15 100644 --- a/reportdesign/source/ui/inspection/metadata.cxx +++ b/reportdesign/source/ui/inspection/metadata.cxx @@ -232,61 +232,61 @@ namespace rptui void OPropertyInfoService::getExcludeProperties(::std::vector< beans::Property >& _rExcludeProperties,const css::uno::Reference< css::inspection::XPropertyHandler >& _xFormComponentHandler) { uno::Sequence< beans::Property > aProps = _xFormComponentHandler->getSupportedProperties(); - static const OUString pExcludeProperties[] = + static const OUStringLiteral pExcludeProperties[] = { - OUString("Enabled"), - OUString("Printable"), - OUString("WordBreak"), - OUString("MultiLine"), - OUString("Tag"), - OUString("HelpText"), - OUString("HelpURL"), - OUString("MaxTextLen"), - OUString("ReadOnly"), - OUString("Tabstop"), - OUString("TabIndex"), - OUString("ValueMin"), - OUString("ValueMax"), - OUString("Spin"), - OUString("SpinValue"), - OUString("SpinValueMin"), - OUString("SpinValueMax"), - OUString("DefaultSpinValue"), - OUString("SpinIncrement"), - OUString("Repeat"), - OUString("RepeatDelay"), - OUString("ControlLabel"), /// TODO: has to be checked - OUString("LabelControl"), - OUString("Title"), // comment this out if you want to have title feature for charts - OUString(PROPERTY_MAXTEXTLEN), - OUString(PROPERTY_EFFECTIVEDEFAULT), - OUString(PROPERTY_EFFECTIVEMAX), - OUString(PROPERTY_EFFECTIVEMIN), - OUString("HideInactiveSelection"), - OUString("SubmitAction"), - OUString("InputRequired"), - OUString("VerticalAlign"), - OUString(PROPERTY_ALIGN), - OUString(PROPERTY_EMPTY_IS_NULL), - OUString(PROPERTY_FILTERPROPOSAL) - ,OUString(PROPERTY_POSITIONX) - ,OUString(PROPERTY_POSITIONY) - ,OUString(PROPERTY_WIDTH) - ,OUString(PROPERTY_HEIGHT) - ,OUString(PROPERTY_FONT) - ,OUString(PROPERTY_LABEL) - ,OUString(PROPERTY_LINECOLOR) - ,OUString(PROPERTY_BORDER) - ,OUString(PROPERTY_BORDERCOLOR) - ,OUString(PROPERTY_BACKTRANSPARENT) - ,OUString(PROPERTY_CONTROLBACKGROUND) - ,OUString(PROPERTY_BACKGROUNDCOLOR) - ,OUString(PROPERTY_CONTROLBACKGROUNDTRANSPARENT) - ,OUString(PROPERTY_FORMULALIST) - ,OUString(PROPERTY_SCOPE) - ,OUString(PROPERTY_TYPE) - ,OUString(PROPERTY_DATASOURCENAME) - ,OUString(PROPERTY_VERTICALALIGN) + OUStringLiteral("Enabled"), + OUStringLiteral("Printable"), + OUStringLiteral("WordBreak"), + OUStringLiteral("MultiLine"), + OUStringLiteral("Tag"), + OUStringLiteral("HelpText"), + OUStringLiteral("HelpURL"), + OUStringLiteral("MaxTextLen"), + OUStringLiteral("ReadOnly"), + OUStringLiteral("Tabstop"), + OUStringLiteral("TabIndex"), + OUStringLiteral("ValueMin"), + OUStringLiteral("ValueMax"), + OUStringLiteral("Spin"), + OUStringLiteral("SpinValue"), + OUStringLiteral("SpinValueMin"), + OUStringLiteral("SpinValueMax"), + OUStringLiteral("DefaultSpinValue"), + OUStringLiteral("SpinIncrement"), + OUStringLiteral("Repeat"), + OUStringLiteral("RepeatDelay"), + OUStringLiteral("ControlLabel"), /// TODO: has to be checked + OUStringLiteral("LabelControl"), + OUStringLiteral("Title"), // comment this out if you want to have title feature for charts + OUStringLiteral(PROPERTY_MAXTEXTLEN), + OUStringLiteral(PROPERTY_EFFECTIVEDEFAULT), + OUStringLiteral(PROPERTY_EFFECTIVEMAX), + OUStringLiteral(PROPERTY_EFFECTIVEMIN), + OUStringLiteral("HideInactiveSelection"), + OUStringLiteral("SubmitAction"), + OUStringLiteral("InputRequired"), + OUStringLiteral("VerticalAlign"), + OUStringLiteral(PROPERTY_ALIGN), + OUStringLiteral(PROPERTY_EMPTY_IS_NULL), + OUStringLiteral(PROPERTY_FILTERPROPOSAL) + ,OUStringLiteral(PROPERTY_POSITIONX) + ,OUStringLiteral(PROPERTY_POSITIONY) + ,OUStringLiteral(PROPERTY_WIDTH) + ,OUStringLiteral(PROPERTY_HEIGHT) + ,OUStringLiteral(PROPERTY_FONT) + ,OUStringLiteral(PROPERTY_LABEL) + ,OUStringLiteral(PROPERTY_LINECOLOR) + ,OUStringLiteral(PROPERTY_BORDER) + ,OUStringLiteral(PROPERTY_BORDERCOLOR) + ,OUStringLiteral(PROPERTY_BACKTRANSPARENT) + ,OUStringLiteral(PROPERTY_CONTROLBACKGROUND) + ,OUStringLiteral(PROPERTY_BACKGROUNDCOLOR) + ,OUStringLiteral(PROPERTY_CONTROLBACKGROUNDTRANSPARENT) + ,OUStringLiteral(PROPERTY_FORMULALIST) + ,OUStringLiteral(PROPERTY_SCOPE) + ,OUStringLiteral(PROPERTY_TYPE) + ,OUStringLiteral(PROPERTY_DATASOURCENAME) + ,OUStringLiteral(PROPERTY_VERTICALALIGN) }; beans::Property* pPropsIter = aProps.getArray(); diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 0ca28052c41b..4e12a3d852b9 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -2069,15 +2069,15 @@ void OReportController::onLoadedMenu(const Reference< frame::XLayoutManager >& _ { if ( _xLayoutManager.is() ) { - static const OUString s_sMenu[] = { - OUString("private:resource/statusbar/statusbar") - ,OUString("private:resource/toolbar/reportcontrols") - ,OUString("private:resource/toolbar/drawbar") - ,OUString("private:resource/toolbar/Formatting") - ,OUString("private:resource/toolbar/alignmentbar") - ,OUString("private:resource/toolbar/sectionalignmentbar") - ,OUString("private:resource/toolbar/resizebar") - ,OUString("private:resource/toolbar/sectionshrinkbar") + static const OUStringLiteral s_sMenu[] = { + OUStringLiteral("private:resource/statusbar/statusbar") + ,OUStringLiteral("private:resource/toolbar/reportcontrols") + ,OUStringLiteral("private:resource/toolbar/drawbar") + ,OUStringLiteral("private:resource/toolbar/Formatting") + ,OUStringLiteral("private:resource/toolbar/alignmentbar") + ,OUStringLiteral("private:resource/toolbar/sectionalignmentbar") + ,OUStringLiteral("private:resource/toolbar/resizebar") + ,OUStringLiteral("private:resource/toolbar/sectionshrinkbar") }; for (const auto & i : s_sMenu) { @@ -4063,9 +4063,7 @@ OUString SAL_CALL OReportController::getMode( ) throw (css::uno::RuntimeExcepti } css::uno::Sequence< OUString > SAL_CALL OReportController::getSupportedModes( ) throw (css::uno::RuntimeException, std::exception) { - static const OUString s_sModes[] = { OUString("remote"), - OUString("normal") }; - return uno::Sequence< OUString> (&s_sModes[0],SAL_N_ELEMENTS(s_sModes)); + return uno::Sequence< OUString> { OUString("remote"), OUString("normal") }; } sal_Bool SAL_CALL OReportController::supportsMode( const OUString& aMode ) throw (css::uno::RuntimeException, std::exception) { diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx index bb1856de76a9..41280a6e7582 100644 --- a/sal/qa/osl/process/osl_process.cxx +++ b/sal/qa/osl/process/osl_process.cxx @@ -67,9 +67,9 @@ #endif #if defined(_WIN32) - const rtl::OUString EXECUTABLE_NAME ("osl_process_child.exe"); + const rtl::OUStringLiteral EXECUTABLE_NAME ("osl_process_child.exe"); #else - const rtl::OUString EXECUTABLE_NAME ("osl_process_child"); + const rtl::OUStringLiteral EXECUTABLE_NAME ("osl_process_child"); #endif using namespace osl; diff --git a/sc/source/ui/vba/vbadialog.cxx b/sc/source/ui/vba/vbadialog.cxx index 1bdae4c0cf15..3cf6fddfa5f9 100644 --- a/sc/source/ui/vba/vbadialog.cxx +++ b/sc/source/ui/vba/vbadialog.cxx @@ -23,33 +23,33 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; -static const OUString aStringList[]= +static const OUStringLiteral aStringList[]= { - OUString( ".uno:Open" ), - OUString( ".uno:FormatCellDialog" ), - OUString( ".uno:InsertCell" ), - OUString( ".uno:Print" ), - OUString( ".uno:PasteSpecial" ), - OUString( ".uno:ToolProtectionDocument" ), - OUString( ".uno:ColumnWidth" ), - OUString( ".uno:DefineName" ), - OUString( ".uno:ConfigureDialog" ), - OUString( ".uno:HyperlinkDialog" ), - OUString( ".uno:InsertGraphic" ), - OUString( ".uno:InsertObject" ), - OUString( ".uno:PageFormatDialog" ), - OUString( ".uno:DataSort" ), - OUString( ".uno:RowHeight" ), - OUString( ".uno:AutoCorrectDlg" ), - OUString( ".uno:ConditionalFormatDialog" ), - OUString( ".uno:DataConsolidate" ), - OUString( ".uno:CreateNames" ), - OUString( ".uno:FillSeries" ), - OUString( ".uno:Validation"), - OUString( ".uno:DefineLabelRange" ), - OUString( ".uno:DataFilterAutoFilter" ), - OUString( ".uno:DataFilterSpecialFilter" ), - OUString( ".uno:AutoFormat" ) + OUStringLiteral( ".uno:Open" ), + OUStringLiteral( ".uno:FormatCellDialog" ), + OUStringLiteral( ".uno:InsertCell" ), + OUStringLiteral( ".uno:Print" ), + OUStringLiteral( ".uno:PasteSpecial" ), + OUStringLiteral( ".uno:ToolProtectionDocument" ), + OUStringLiteral( ".uno:ColumnWidth" ), + OUStringLiteral( ".uno:DefineName" ), + OUStringLiteral( ".uno:ConfigureDialog" ), + OUStringLiteral( ".uno:HyperlinkDialog" ), + OUStringLiteral( ".uno:InsertGraphic" ), + OUStringLiteral( ".uno:InsertObject" ), + OUStringLiteral( ".uno:PageFormatDialog" ), + OUStringLiteral( ".uno:DataSort" ), + OUStringLiteral( ".uno:RowHeight" ), + OUStringLiteral( ".uno:AutoCorrectDlg" ), + OUStringLiteral( ".uno:ConditionalFormatDialog" ), + OUStringLiteral( ".uno:DataConsolidate" ), + OUStringLiteral( ".uno:CreateNames" ), + OUStringLiteral( ".uno:FillSeries" ), + OUStringLiteral( ".uno:Validation"), + OUStringLiteral( ".uno:DefineLabelRange" ), + OUStringLiteral( ".uno:DataFilterAutoFilter" ), + OUStringLiteral( ".uno:DataFilterSpecialFilter" ), + OUStringLiteral( ".uno:AutoFormat" ) }; const sal_Int32 nDialogSize = SAL_N_ELEMENTS(aStringList); diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx index 282a6436ad06..5b7125709eee 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx @@ -422,11 +422,10 @@ uno::Sequence< OUString> SAL_CALL { ThrowIfDisposed (); - static const OUString sServiceNames[2] = { + return uno::Sequence<OUString> { OUString("com.sun.star.accessibility.Accessible"), OUString("com.sun.star.accessibility.AccessibleContext") }; - return uno::Sequence<OUString> (sServiceNames, 2); } void AccessibleSlideSorterObject::ThrowIfDisposed() diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx index 11cf574bd0f6..1afc650031a8 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx @@ -636,12 +636,11 @@ uno::Sequence< OUString> SAL_CALL { ThrowIfDisposed (); - static const OUString sServiceNames[3] = { + return uno::Sequence<OUString> { OUString("com.sun.star.accessibility.Accessible"), OUString("com.sun.star.accessibility.AccessibleContext"), OUString("com.sun.star.drawing.AccessibleSlideSorterView") }; - return uno::Sequence<OUString> (sServiceNames, 3); } void AccessibleSlideSorterView::ThrowIfDisposed() diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index f1eb9e83ba5f..c78d4d325543 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -77,19 +77,15 @@ static const sal_Int32 nCellHeight = 7; // one pixel is shared with the next cel static const sal_Int32 nBitmapWidth = (nCellWidth * nPreviewColumns) - (nPreviewColumns - 1); static const sal_Int32 nBitmapHeight = (nCellHeight * nPreviewRows) - (nPreviewRows - 1); -static const OUString* getPropertyNames() +static const OUStringLiteral gPropNames[ CB_COUNT ] = { - static const OUString gPropNames[ CB_COUNT ] = - { - OUString("UseFirstRowStyle") , - OUString("UseLastRowStyle") , - OUString("UseBandingRowStyle") , - OUString("UseFirstColumnStyle") , - OUString("UseLastColumnStyle") , - OUString("UseBandingColumnStyle") - }; - return &gPropNames[0]; -} + OUStringLiteral("UseFirstRowStyle") , + OUStringLiteral("UseLastRowStyle") , + OUStringLiteral("UseBandingRowStyle") , + OUStringLiteral("UseFirstColumnStyle") , + OUStringLiteral("UseLastColumnStyle") , + OUStringLiteral("UseBandingColumnStyle") +}; TableDesignWidget::TableDesignWidget( VclBuilderContainer* pParent, ViewShellBase& rBase, bool bModal ) : mrBase(rBase) @@ -112,10 +108,9 @@ TableDesignWidget::TableDesignWidget( VclBuilderContainer* pParent, ViewShellBas } m_pValueSet->SetSelectHdl (LINK(this, TableDesignWidget, implValueSetHdl)); - const OUString* pPropNames = getPropertyNames(); for (sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i) { - pParent->get(m_aCheckBoxes[i], OUStringToOString(pPropNames[i], RTL_TEXTENCODING_UTF8)); + pParent->get(m_aCheckBoxes[i], OUStringToOString(gPropNames[i], RTL_TEXTENCODING_UTF8)); m_aCheckBoxes[i]->SetClickHdl( LINK( this, TableDesignWidget, implCheckBoxHdl ) ); } @@ -378,14 +373,13 @@ void TableDesignWidget::updateControls() static const bool gDefaults[CB_COUNT] = { true, false, true, false, false, false }; const bool bHasTable = mxSelectedTable.is(); - const OUString* pPropNames = getPropertyNames(); for (sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i) { bool bUse = gDefaults[i]; if( bHasTable ) try { - mxSelectedTable->getPropertyValue( *pPropNames++ ) >>= bUse; + mxSelectedTable->getPropertyValue( gPropNames[i] ) >>= bUse; } catch( Exception& ) { diff --git a/shell/source/unix/sysshell/recently_used_file.cxx b/shell/source/unix/sysshell/recently_used_file.cxx index 5a9b4643081b..b15cc9b52a77 100644 --- a/shell/source/unix/sysshell/recently_used_file.cxx +++ b/shell/source/unix/sysshell/recently_used_file.cxx @@ -30,15 +30,15 @@ #include <fcntl.h> #include <unistd.h> -const OUString RECENTLY_USED_FILE_NAME(".recently-used"); -const OUString SLASH("/"); +const OUStringLiteral RECENTLY_USED_FILE_NAME(".recently-used"); +const char SLASH[] = "/"; namespace /* private */ { inline void ensure_final_slash(/*inout*/ OUString& path) { if (!path.isEmpty() && - (SLASH.pData->buffer[0] != path.pData->buffer[path.getLength() - 1])) + (SLASH[0] != path.pData->buffer[path.getLength() - 1])) path += SLASH; } diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx index d947d6ca6dd3..8475b7c1635b 100644 --- a/svtools/source/config/menuoptions.cxx +++ b/svtools/source/config/menuoptions.cxx @@ -51,8 +51,6 @@ using namespace ::com::sun::star::uno ; #define PROPERTYHANDLE_SHOWICONSINMENUES 2 #define PROPERTYHANDLE_SYSTEMICONSINMENUES 3 -#define PROPERTYCOUNT 4 - #include <tools/link.hxx> // private declarations! @@ -301,17 +299,12 @@ void SvtMenuOptions_Impl::ImplCommit() Sequence< OUString > const & SvtMenuOptions_Impl::impl_GetPropertyNames() { - // Build static list of configuration key names. - static const OUString pProperties[] = - { + static const Sequence<OUString> seqPropertyNames { OUString(PROPERTYNAME_DONTHIDEDISABLEDENTRIES) , OUString(PROPERTYNAME_FOLLOWMOUSE) , OUString(PROPERTYNAME_SHOWICONSINMENUES) , OUString(PROPERTYNAME_SYSTEMICONSINMENUES) }; - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - // ... and return it. return seqPropertyNames; } diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index fbb6d18f221e..6f40844c9088 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1594,24 +1594,22 @@ Reference< XIndexContainer > FmXGridPeer::getColumns() throw( RuntimeException, void FmXGridPeer::addColumnListeners(const Reference< XPropertySet >& xCol) { - static const OUString aPropsListenedTo[] = + static const OUStringLiteral aPropsListenedTo[] = { - OUString(FM_PROP_LABEL), OUString(FM_PROP_WIDTH), OUString(FM_PROP_HIDDEN), OUString(FM_PROP_ALIGN), OUString(FM_PROP_FORMATKEY) + OUStringLiteral(FM_PROP_LABEL), OUStringLiteral(FM_PROP_WIDTH), OUStringLiteral(FM_PROP_HIDDEN), + OUStringLiteral(FM_PROP_ALIGN), OUStringLiteral(FM_PROP_FORMATKEY) }; // as not all properties have to be supported by all columns we have to check this // before adding a listener Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo(); - Property aPropDesc; - const OUString* pProps = aPropsListenedTo; - const OUString* pPropsEnd = pProps + SAL_N_ELEMENTS( aPropsListenedTo ); - for (; pProps != pPropsEnd; ++pProps) + for (unsigned i=0; i<SAL_N_ELEMENTS(aPropsListenedTo); ++i) { - if ( xInfo->hasPropertyByName( *pProps ) ) + if ( xInfo->hasPropertyByName( aPropsListenedTo[i] ) ) { - aPropDesc = xInfo->getPropertyByName( *pProps ); + Property aPropDesc = xInfo->getPropertyByName( aPropsListenedTo[i] ); if ( 0 != ( aPropDesc.Attributes & PropertyAttribute::BOUND ) ) - xCol->addPropertyChangeListener( *pProps, this ); + xCol->addPropertyChangeListener( aPropsListenedTo[i], this ); } } } @@ -1621,9 +1619,10 @@ 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 OUString aPropsListenedTo[] = + static const OUStringLiteral aPropsListenedTo[] = { - OUString(FM_PROP_LABEL), OUString(FM_PROP_WIDTH), OUString(FM_PROP_HIDDEN), OUString(FM_PROP_ALIGN), OUString(FM_PROP_FORMATKEY) + OUStringLiteral(FM_PROP_LABEL), OUStringLiteral(FM_PROP_WIDTH), OUStringLiteral(FM_PROP_HIDDEN), + OUStringLiteral(FM_PROP_ALIGN), OUStringLiteral(FM_PROP_FORMATKEY) }; Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo(); diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx index a11a99eaaa1d..3b980e493c45 100644 --- a/svx/source/form/fmdmod.cxx +++ b/svx/source/form/fmdmod.cxx @@ -62,27 +62,27 @@ SAL_WNOUNREACHABLE_CODE_POP ::com::sun::star::uno::Sequence< OUString > SAL_CALL SvxFmMSFactory::getAvailableServiceNames() throw( ::com::sun::star::uno::RuntimeException, std::exception ) { - static const OUString aSvxComponentServiceNameList[] = + static const OUStringLiteral aSvxComponentServiceNameList[] = { - OUString(FM_SUN_COMPONENT_TEXTFIELD), - OUString(FM_SUN_COMPONENT_FORM), - OUString(FM_SUN_COMPONENT_LISTBOX), - OUString(FM_SUN_COMPONENT_COMBOBOX), - OUString(FM_SUN_COMPONENT_RADIOBUTTON), - OUString(FM_SUN_COMPONENT_GROUPBOX), - OUString(FM_SUN_COMPONENT_FIXEDTEXT), - OUString(FM_SUN_COMPONENT_COMMANDBUTTON), - OUString(FM_SUN_COMPONENT_CHECKBOX), - OUString(FM_SUN_COMPONENT_GRIDCONTROL), - OUString(FM_SUN_COMPONENT_IMAGEBUTTON), - OUString(FM_SUN_COMPONENT_FILECONTROL), - OUString(FM_SUN_COMPONENT_TIMEFIELD), - OUString(FM_SUN_COMPONENT_DATEFIELD), - OUString(FM_SUN_COMPONENT_NUMERICFIELD), - OUString(FM_SUN_COMPONENT_CURRENCYFIELD), - OUString(FM_SUN_COMPONENT_PATTERNFIELD), - OUString(FM_SUN_COMPONENT_HIDDENCONTROL), - OUString(FM_SUN_COMPONENT_IMAGECONTROL) + OUStringLiteral(FM_SUN_COMPONENT_TEXTFIELD), + OUStringLiteral(FM_SUN_COMPONENT_FORM), + OUStringLiteral(FM_SUN_COMPONENT_LISTBOX), + OUStringLiteral(FM_SUN_COMPONENT_COMBOBOX), + OUStringLiteral(FM_SUN_COMPONENT_RADIOBUTTON), + OUStringLiteral(FM_SUN_COMPONENT_GROUPBOX), + OUStringLiteral(FM_SUN_COMPONENT_FIXEDTEXT), + OUStringLiteral(FM_SUN_COMPONENT_COMMANDBUTTON), + OUStringLiteral(FM_SUN_COMPONENT_CHECKBOX), + OUStringLiteral(FM_SUN_COMPONENT_GRIDCONTROL), + OUStringLiteral(FM_SUN_COMPONENT_IMAGEBUTTON), + OUStringLiteral(FM_SUN_COMPONENT_FILECONTROL), + OUStringLiteral(FM_SUN_COMPONENT_TIMEFIELD), + OUStringLiteral(FM_SUN_COMPONENT_DATEFIELD), + OUStringLiteral(FM_SUN_COMPONENT_NUMERICFIELD), + OUStringLiteral(FM_SUN_COMPONENT_CURRENCYFIELD), + OUStringLiteral(FM_SUN_COMPONENT_PATTERNFIELD), + OUStringLiteral(FM_SUN_COMPONENT_HIDDENCONTROL), + OUStringLiteral(FM_SUN_COMPONENT_IMAGECONTROL) }; static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList); diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index db6162f7d1ac..22476b5e6a46 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -535,13 +535,13 @@ 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 const OUString pDefaultValueProperties[] = { - OUString(FM_PROP_DEFAULT_TEXT), OUString(FM_PROP_DEFAULTCHECKED), OUString(FM_PROP_DEFAULT_DATE), OUString(FM_PROP_DEFAULT_TIME), - OUString(FM_PROP_DEFAULT_VALUE), OUString(FM_PROP_DEFAULT_SELECT_SEQ), OUString(FM_PROP_EFFECTIVE_DEFAULT) + static const OUStringLiteral pDefaultValueProperties[] = { + OUStringLiteral(FM_PROP_DEFAULT_TEXT), OUStringLiteral(FM_PROP_DEFAULTCHECKED), OUStringLiteral(FM_PROP_DEFAULT_DATE), OUStringLiteral(FM_PROP_DEFAULT_TIME), + OUStringLiteral(FM_PROP_DEFAULT_VALUE), OUStringLiteral(FM_PROP_DEFAULT_SELECT_SEQ), OUStringLiteral(FM_PROP_EFFECTIVE_DEFAULT) }; - const OUString aValueProperties[] = { - OUString(FM_PROP_TEXT), OUString(FM_PROP_STATE), OUString(FM_PROP_DATE), OUString(FM_PROP_TIME), - OUString(FM_PROP_VALUE), OUString(FM_PROP_SELECT_SEQ), OUString(FM_PROP_EFFECTIVE_VALUE) + static const OUStringLiteral aValueProperties[] = { + OUStringLiteral(FM_PROP_TEXT), OUStringLiteral(FM_PROP_STATE), OUStringLiteral(FM_PROP_DATE), OUStringLiteral(FM_PROP_TIME), + OUStringLiteral(FM_PROP_VALUE), OUStringLiteral(FM_PROP_SELECT_SEQ), OUStringLiteral(FM_PROP_EFFECTIVE_VALUE) }; sal_Int32 nDefaultValueProps = SAL_N_ELEMENTS(pDefaultValueProperties); OSL_ENSURE(SAL_N_ELEMENTS(aValueProperties) == nDefaultValueProps, diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 40ca4e5fc10f..813f548411dc 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -896,9 +896,9 @@ void SwUiWriterTest::testCommentedWord() // Chinese conversion tests -static const OUString CHINESE_TRADITIONAL_CONTENT(sal_Unicode(0x9F8D)); -static const OUString CHINESE_SIMPLIFIED_CONTENT(sal_Unicode(0x9F99)); -static const OUString NON_CHINESE_CONTENT ("Hippopotamus"); +static const sal_Unicode CHINESE_TRADITIONAL_CONTENT(0x9F8D); +static const sal_Unicode CHINESE_SIMPLIFIED_CONTENT(0x9F99); +static const OUStringLiteral NON_CHINESE_CONTENT("Hippopotamus"); // Tests that a blank document is still blank after conversion void SwUiWriterTest::testChineseConversionBlank() @@ -943,7 +943,7 @@ void SwUiWriterTest::testChineseConversionNonChineseText() // Then SwTextNode* pTextNode = aPaM.GetNode().GetTextNode(); - CPPUNIT_ASSERT_EQUAL(NON_CHINESE_CONTENT, pTextNode->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString(NON_CHINESE_CONTENT), pTextNode->GetText()); } @@ -957,7 +957,7 @@ void SwUiWriterTest::testChineseConversionTraditionalToSimplified() const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwPaM aPaM(aIdx); - pDoc->getIDocumentContentOperations().InsertString(aPaM, CHINESE_TRADITIONAL_CONTENT); + pDoc->getIDocumentContentOperations().InsertString(aPaM, OUString(CHINESE_TRADITIONAL_CONTENT)); // When SwHHCWrapper aWrap( pView, xContext, LANGUAGE_CHINESE_TRADITIONAL, LANGUAGE_CHINESE_SIMPLIFIED, nullptr, @@ -967,7 +967,7 @@ void SwUiWriterTest::testChineseConversionTraditionalToSimplified() // Then SwTextNode* pTextNode = aPaM.GetNode().GetTextNode(); - CPPUNIT_ASSERT_EQUAL(CHINESE_SIMPLIFIED_CONTENT, pTextNode->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString(CHINESE_SIMPLIFIED_CONTENT), pTextNode->GetText()); } @@ -981,7 +981,7 @@ void SwUiWriterTest::testChineseConversionSimplifiedToTraditional() const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwPaM aPaM(aIdx); - pDoc->getIDocumentContentOperations().InsertString(aPaM, CHINESE_SIMPLIFIED_CONTENT); + pDoc->getIDocumentContentOperations().InsertString(aPaM, OUString(CHINESE_SIMPLIFIED_CONTENT)); // When SwHHCWrapper aWrap( pView, xContext, LANGUAGE_CHINESE_SIMPLIFIED, LANGUAGE_CHINESE_TRADITIONAL, nullptr, @@ -991,7 +991,7 @@ void SwUiWriterTest::testChineseConversionSimplifiedToTraditional() // Then SwTextNode* pTextNode = aPaM.GetNode().GetTextNode(); - CPPUNIT_ASSERT_EQUAL(CHINESE_TRADITIONAL_CONTENT, pTextNode->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString(CHINESE_TRADITIONAL_CONTENT), pTextNode->GetText()); } diff --git a/vcl/qa/cppunit/app/test_IconThemeSelector.cxx b/vcl/qa/cppunit/app/test_IconThemeSelector.cxx index e32ccd209c8e..8863f10eaff1 100644 --- a/vcl/qa/cppunit/app/test_IconThemeSelector.cxx +++ b/vcl/qa/cppunit/app/test_IconThemeSelector.cxx @@ -163,7 +163,7 @@ IconThemeSelectorTest::FallbackThemeIsReturnedForEmptyInput() vcl::IconThemeSelector s; OUString selected = s.SelectIconTheme(std::vector<vcl::IconThemeInfo>(), "oxygen"); CPPUNIT_ASSERT_EQUAL_MESSAGE("fallback is returned for empty input", - vcl::IconThemeSelector::FALLBACK_ICON_THEME_ID, selected); + OUString(vcl::IconThemeSelector::FALLBACK_ICON_THEME_ID), selected); } void diff --git a/vcl/source/app/IconThemeInfo.cxx b/vcl/source/app/IconThemeInfo.cxx index 37d35dd0c513..a354b0dbb9a0 100644 --- a/vcl/source/app/IconThemeInfo.cxx +++ b/vcl/source/app/IconThemeInfo.cxx @@ -16,13 +16,13 @@ // constants for theme ids and display names. Only the theme id for hicontrast is used // outside of this class and hence made public. -const OUString vcl::IconThemeInfo::HIGH_CONTRAST_ID = "hicontrast"; +const OUStringLiteral vcl::IconThemeInfo::HIGH_CONTRAST_ID("hicontrast"); namespace { -static const OUString HIGH_CONTRAST_DISPLAY_NAME = "High Contrast"; -static const OUString TANGO_TESTING_ID = "tango_testing"; -static const OUString TANGO_TESTING_DISPLAY_NAME = "Tango Testing"; +static const OUStringLiteral HIGH_CONTRAST_DISPLAY_NAME("High Contrast"); +static const OUStringLiteral TANGO_TESTING_ID("tango_testing"); +static const OUStringLiteral TANGO_TESTING_DISPLAY_NAME("Tango Testing"); OUString filename_from_url(const OUString& url) diff --git a/vcl/source/app/IconThemeSelector.cxx b/vcl/source/app/IconThemeSelector.cxx index 5948856f0ea8..ce91d5b2eca2 100644 --- a/vcl/source/app/IconThemeSelector.cxx +++ b/vcl/source/app/IconThemeSelector.cxx @@ -16,8 +16,7 @@ namespace vcl { -/*static*/ const OUString -IconThemeSelector::FALLBACK_ICON_THEME_ID("tango"); +/*static*/ const OUStringLiteral IconThemeSelector::FALLBACK_ICON_THEME_ID("tango"); namespace { |