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>
This commit is contained in:
Noel Grandin 2016-07-21 14:23:23 +02:00 committed by Noel Grandin
parent ce95e39f8e
commit 127f70d66a
33 changed files with 372 additions and 284 deletions

View File

@ -136,7 +136,7 @@ void Chart2TrendCalculators::testPotentialRegression2()
xValues[i] = d; xValues[i] = d;
yValues[i] = -2.0 * pow ( d, 3 ); 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 // test y = - 2 X - 5
@ -152,7 +152,7 @@ void Chart2TrendCalculators::testLinearRegression1()
xValues[i] = d; xValues[i] = d;
yValues[i] = - 2.0 * d - 5.0 ; 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 // test y = A x ^ B
@ -168,7 +168,7 @@ void Chart2TrendCalculators::testPolynomialRegression1()
xValues[i] = d; xValues[i] = d;
yValues[i] = - 2.0 * d * d + 4 * d - 5; 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 ); checkCalculator( xValues, yValues, sExpectedFormula );
} }
@ -199,7 +199,7 @@ void Chart2TrendCalculators::testExponentialRegression2()
xValues[i] = d; xValues[i] = d;
yValues[i] = -2.0 * exp ( 0.3 * 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 )");
} }

View File

@ -176,7 +176,7 @@ OUString PotentialRegressionCurveCalculator::ImplGetRepresentation(
// if nValueLength not calculated then nullptr // if nValueLength not calculated then nullptr
sal_Int32* pValueLength = nValueLength ? &nValueLength : nullptr; sal_Int32* pValueLength = nValueLength ? &nValueLength : nullptr;
if ( m_fIntercept < 0.0 ) // add intercept value if ( m_fIntercept < 0.0 ) // add intercept value
aTmpBuf.append( aMinusSign+" " ); aTmpBuf.append( aMinusSign+" " );
if( bHasIntercept ) if( bHasIntercept )
{ {
OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fIntercept), pValueLength ); OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fIntercept), pValueLength );

View File

@ -989,7 +989,7 @@ bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < embed
// the media type will be provided with object insertion // the media type will be provided with object insertion
OUString aOrigStorMediaType; OUString aOrigStorMediaType;
uno::Reference< beans::XPropertySet > xStorProps( pImpl->mxStorage, uno::UNO_QUERY_THROW ); 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; xStorProps->getPropertyValue( s_sMediaType ) >>= aOrigStorMediaType;
SAL_WARN_IF( aOrigStorMediaType.isEmpty(), "comphelper.container", "No valuable media type in the storage!\n" ); SAL_WARN_IF( aOrigStorMediaType.isEmpty(), "comphelper.container", "No valuable media type in the storage!\n" );

View File

@ -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: */

View File

@ -460,10 +460,7 @@ void OCalcTable::fillColumns()
switch ( eType ) switch ( eType )
{ {
case DataType::VARCHAR: case DataType::VARCHAR:
{ aTypeName = "VARCHAR";
static const OUString s_sType("VARCHAR");
aTypeName = s_sType;
}
break; break;
case DataType::DECIMAL: case DataType::DECIMAL:
aTypeName = "DECIMAL"; aTypeName = "DECIMAL";

View File

@ -75,7 +75,11 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::uno; 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::Connection(FirebirdDriver* _pDriver)
: Connection_BASE(m_aMutex) : Connection_BASE(m_aMutex)

View File

@ -71,12 +71,6 @@ namespace connectivity
{ {
friend class connectivity::OSubComponent<Connection, Connection_BASE>; 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; ::osl::Mutex m_aMutex;
TTypeInfoVector m_aTypeInfo; // vector containing an entry TTypeInfoVector m_aTypeInfo; // vector containing an entry

View File

@ -57,10 +57,12 @@ namespace connectivity
} }
} }
// Static const member variables // Static const variables
const OUString FirebirdDriver::our_sFirebirdTmpVar("FIREBIRD_TMP"); namespace {
const OUString FirebirdDriver::our_sFirebirdLockVar("FIREBIRD_LOCK"); const char our_sFirebirdTmpVar[] = "FIREBIRD_TMP";
const OUString FirebirdDriver::our_sFirebirdMsgVar("FIREBIRD_MSG"); const char our_sFirebirdLockVar[] = "FIREBIRD_LOCK";
const char our_sFirebirdMsgVar[] = "FIREBIRD_MSG";
};
FirebirdDriver::FirebirdDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext) FirebirdDriver::FirebirdDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext)
: ODriver_BASE(m_aMutex) : 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. // we can create directories for firebird at will.
// Overrides firebird's default of /tmp or c:\temp // 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 // 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 #ifndef SYSTEM_FIREBIRD
// Overrides firebird's hardcoded default of /usr/local/firebird on *nix, // 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); ::rtl::Bootstrap::expandMacros(sMsgURL);
OUString sMsgPath; OUString sMsgPath;
::osl::FileBase::getSystemPathFromFileURL(sMsgURL, sMsgPath); ::osl::FileBase::getSystemPathFromFileURL(sMsgURL, sMsgPath);
osl_setEnvironment(our_sFirebirdMsgVar.pData, sMsgPath.pData); osl_setEnvironment(OUString(our_sFirebirdMsgVar).pData, sMsgPath.pData);
#endif #endif
} }
@ -113,11 +115,11 @@ void FirebirdDriver::disposing()
} }
m_xConnections.clear(); m_xConnections.clear();
osl_clearEnvironment(our_sFirebirdTmpVar.pData); osl_clearEnvironment(OUString(our_sFirebirdTmpVar).pData);
osl_clearEnvironment(our_sFirebirdLockVar.pData); osl_clearEnvironment(OUString(our_sFirebirdLockVar).pData);
#ifndef SYSTEM_FIREBIRD #ifndef SYSTEM_FIREBIRD
osl_clearEnvironment(our_sFirebirdMsgVar.pData); osl_clearEnvironment(OUString(our_sFirebirdMsgVar).pData);
#endif #endif
OSL_VERIFY(fb_shutdown(0, 1)); OSL_VERIFY(fb_shutdown(0, 1));

View File

@ -47,10 +47,6 @@ namespace connectivity
class FirebirdDriver : public ODriver_BASE class FirebirdDriver : public ODriver_BASE
{ {
private: 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; css::uno::Reference<css::uno::XComponentContext> m_aContext;
::utl::TempFile m_firebirdTMPDirectory; ::utl::TempFile m_firebirdTMPDirectory;
::utl::TempFile m_firebirdLockDirectory; ::utl::TempFile m_firebirdLockDirectory;

View File

@ -431,14 +431,14 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges(
{ {
// here we know that the count of column doesn't match // here we know that the count of column doesn't match
::std::map<sal_Int32,sal_Int32> aColumnMatching; ::std::map<sal_Int32,sal_Int32> aColumnMatching;
static const OUString sPrivs[] = { static const OUStringLiteral sPrivs[] = {
OUString("TABLE_CAT"), OUStringLiteral("TABLE_CAT"),
OUString("TABLE_SCHEM"), OUStringLiteral("TABLE_SCHEM"),
OUString("TABLE_NAME"), OUStringLiteral("TABLE_NAME"),
OUString("GRANTOR"), OUStringLiteral("GRANTOR"),
OUString("GRANTEE"), OUStringLiteral("GRANTEE"),
OUString("PRIVILEGE"), OUStringLiteral("PRIVILEGE"),
OUString("IS_GRANTABLE") OUStringLiteral("IS_GRANTABLE")
}; };
OUString sColumnName; OUString sColumnName;

View File

@ -837,10 +837,10 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException, std::exception) Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException, std::exception)
{ {
// there exists no possibility to get table types so we have to check // there exists no possibility to get table types so we have to check
static const OUString sTableTypes[] = static const OUStringLiteral sTableTypes[] =
{ {
OUString("TABLE"), OUStringLiteral("TABLE"),
OUString("VIEW") OUStringLiteral("VIEW")
// Currently we only support a 'TABLE' and 'VIEW' nothing more complex // Currently we only support a 'TABLE' and 'VIEW' nothing more complex
// OUString("SYSTEM TABLE"), // OUString("SYSTEM TABLE"),
@ -858,7 +858,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLE
{ {
ODatabaseMetaDataResultSet::ORow aRow; ODatabaseMetaDataResultSet::ORow aRow;
aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
aRow.push_back(new ORowSetValueDecorator(sTableType)); aRow.push_back(new ORowSetValueDecorator(OUString(sTableType)));
// bound row // bound row
aRows.push_back(aRow); aRows.push_back(aRow);
} }

View File

@ -581,28 +581,19 @@ ConvertSvxConfigEntry(
const uno::Reference< container::XNameAccess >& xCommandToLabelMap, const uno::Reference< container::XNameAccess >& xCommandToLabelMap,
const SvxConfigEntry* pEntry ) 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 ); uno::Sequence< beans::PropertyValue > aPropSeq( 3 );
aPropSeq[0].Name = aDescriptorCommandURL; aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
aPropSeq[0].Value <<= OUString( pEntry->GetCommand() ); aPropSeq[0].Value <<= OUString( pEntry->GetCommand() );
aPropSeq[1].Name = aDescriptorType; aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE;
aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT; aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
// If the name has not been changed and the name is the same as // 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 // in the default command to label map then the label can be stored
// as an empty string. // as an empty string.
// It will be initialised again later using the command to label map. // 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() ) if ( !pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty() )
{ {
bool isDefaultName = false; bool isDefaultName = false;
@ -614,7 +605,7 @@ ConvertSvxConfigEntry(
{ {
for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); ++i ) for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); ++i )
{ {
if ( tmpPropSeq[i].Name.equals( aDescriptorLabel ) ) if ( tmpPropSeq[i].Name == ITEM_DESCRIPTOR_LABEL )
{ {
OUString tmpLabel; OUString tmpLabel;
tmpPropSeq[i].Value >>= tmpLabel; tmpPropSeq[i].Value >>= tmpLabel;
@ -656,31 +647,19 @@ ConvertToolbarEntry(
const uno::Reference< container::XNameAccess >& xCommandToLabelMap, const uno::Reference< container::XNameAccess >& xCommandToLabelMap,
const SvxConfigEntry* pEntry ) 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 ); uno::Sequence< beans::PropertyValue > aPropSeq( 4 );
aPropSeq[0].Name = aDescriptorCommandURL; aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
aPropSeq[0].Value <<= OUString( pEntry->GetCommand() ); aPropSeq[0].Value <<= OUString( pEntry->GetCommand() );
aPropSeq[1].Name = aDescriptorType; aPropSeq[1].Name = ITEM_DESCRIPTOR_TYPE;
aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT; aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT;
// If the name has not been changed and the name is the same as // 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 // in the default command to label map then the label can be stored
// as an empty string. // as an empty string.
// It will be initialised again later using the command to label map. // 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() ) if ( !pEntry->HasChangedName() && !pEntry->GetCommand().isEmpty() )
{ {
bool isDefaultName = false; bool isDefaultName = false;
@ -692,7 +671,7 @@ ConvertToolbarEntry(
{ {
for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); ++i ) for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); ++i )
{ {
if ( tmpPropSeq[i].Name.equals( aDescriptorLabel ) ) if ( tmpPropSeq[i].Name == ITEM_DESCRIPTOR_LABEL )
{ {
OUString tmpLabel; OUString tmpLabel;
tmpPropSeq[i].Value >>= tmpLabel; tmpPropSeq[i].Value >>= tmpLabel;
@ -726,7 +705,7 @@ ConvertToolbarEntry(
aPropSeq[2].Value <<= OUString( pEntry->GetName() ); aPropSeq[2].Value <<= OUString( pEntry->GetName() );
} }
aPropSeq[3].Name = aIsVisible; aPropSeq[3].Name = ITEM_DESCRIPTOR_ISVISIBLE;
aPropSeq[3].Value <<= pEntry->IsVisible(); aPropSeq[3].Value <<= pEntry->IsVisible();
return aPropSeq; return aPropSeq;

View File

@ -30,7 +30,7 @@ class VCL_DLLPUBLIC IconThemeInfo {
public: public:
/** The name of the icon theme to use for high contrast mode */ /** 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. /** Construct an IconThemeInfo from the URL to a file.
* This method will throw a std::runtime_error if the URL cannot be properly parsed. * This method will throw a std::runtime_error if the URL cannot be properly parsed.

View File

@ -77,8 +77,7 @@ private:
ReturnFallback(const std::vector<IconThemeInfo>& installedThemes); ReturnFallback(const std::vector<IconThemeInfo>& installedThemes);
/** The name of the icon theme which is used as fallback */ /** The name of the icon theme which is used as fallback */
static const OUString static const OUStringLiteral FALLBACK_ICON_THEME_ID;
FALLBACK_ICON_THEME_ID;
static OUString static OUString

View File

@ -1099,11 +1099,7 @@ OString XMLUtil::QuotHTML( const OString &rString )
UErrorCode nIcuErr = U_ZERO_ERROR; UErrorCode nIcuErr = U_ZERO_ERROR;
static const sal_uInt32 nSearchFlags = static const sal_uInt32 nSearchFlags =
UREGEX_DOTALL | UREGEX_CASE_INSENSITIVE; UREGEX_DOTALL | UREGEX_CASE_INSENSITIVE;
static const OUString sPattern( static const UnicodeString sSearchPat( "<[/]\?\?[a-z_-]+?(?:| +[a-z]+?=\".*?\") *[/]\?\?>" );
"<[/]\?\?[a-z_-]+?(?:| +[a-z]+?=\".*?\") *[/]\?\?>");
static const UnicodeString sSearchPat(
reinterpret_cast<const UChar*>(sPattern.getStr()),
sPattern.getLength() );
const OUString sOUSource = OStringToOUString(rString, RTL_TEXTENCODING_UTF8); const OUString sOUSource = OStringToOUString(rString, RTL_TEXTENCODING_UTF8);
icu::UnicodeString sSource( icu::UnicodeString sSource(

View File

@ -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 ) uno::Sequence< OUString > SAL_CALL OReportDefinition::getAvailableServiceNames() throw( uno::RuntimeException, std::exception )
{ {
static const OUString aSvxComponentServiceNameList[] = static const OUStringLiteral aSvxComponentServiceNameList[] =
{ {
OUString("com.sun.star.form.component.FixedText"), OUStringLiteral("com.sun.star.form.component.FixedText"),
OUString("com.sun.star.form.component.DatabaseImageControl"), OUStringLiteral("com.sun.star.form.component.DatabaseImageControl"),
OUString("com.sun.star.style.PageStyle"), OUStringLiteral("com.sun.star.style.PageStyle"),
OUString("com.sun.star.style.GraphicStyle"), OUStringLiteral("com.sun.star.style.GraphicStyle"),
OUString("com.sun.star.style.FrameStyle"), OUStringLiteral("com.sun.star.style.FrameStyle"),
OUString("com.sun.star.drawing.Defaults"), OUStringLiteral("com.sun.star.drawing.Defaults"),
OUString("com.sun.star.document.ImportEmbeddedObjectResolver"), OUStringLiteral("com.sun.star.document.ImportEmbeddedObjectResolver"),
OUString("com.sun.star.document.ExportEmbeddedObjectResolver"), OUStringLiteral("com.sun.star.document.ExportEmbeddedObjectResolver"),
OUString("com.sun.star.document.ImportGraphicObjectResolver"), OUStringLiteral("com.sun.star.document.ImportGraphicObjectResolver"),
OUString("com.sun.star.document.ExportGraphicObjectResolver"), OUStringLiteral("com.sun.star.document.ExportGraphicObjectResolver"),
OUString("com.sun.star.chart2.data.DataProvider"), OUStringLiteral("com.sun.star.chart2.data.DataProvider"),
OUString("com.sun.star.xml.NamespaceMap"), OUStringLiteral("com.sun.star.xml.NamespaceMap"),
OUString("com.sun.star.document.Settings"), OUStringLiteral("com.sun.star.document.Settings"),
OUString("com.sun.star.drawing.GradientTable"), OUStringLiteral("com.sun.star.drawing.GradientTable"),
OUString("com.sun.star.drawing.HatchTable"), OUStringLiteral("com.sun.star.drawing.HatchTable"),
OUString("com.sun.star.drawing.BitmapTable"), OUStringLiteral("com.sun.star.drawing.BitmapTable"),
OUString("com.sun.star.drawing.TransparencyGradientTable"), OUStringLiteral("com.sun.star.drawing.TransparencyGradientTable"),
OUString("com.sun.star.drawing.DashTable"), OUStringLiteral("com.sun.star.drawing.DashTable"),
OUString("com.sun.star.drawing.MarkerTable") OUStringLiteral("com.sun.star.drawing.MarkerTable")
}; };
static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList); static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList);

View File

@ -366,15 +366,15 @@ uno::Sequence< beans::Property > SAL_CALL DataProviderHandler::getSupportedPrope
{ {
rptui::OPropertyInfoService::getExcludeProperties( aNewProps, m_xFormComponentHandler ); rptui::OPropertyInfoService::getExcludeProperties( aNewProps, m_xFormComponentHandler );
beans::Property aValue; beans::Property aValue;
static const OUString s_pProperties[] = static const OUStringLiteral s_pProperties[] =
{ {
OUString(PROPERTY_CHARTTYPE) OUStringLiteral(PROPERTY_CHARTTYPE)
,OUString(PROPERTY_MASTERFIELDS) ,OUStringLiteral(PROPERTY_MASTERFIELDS)
,OUString(PROPERTY_DETAILFIELDS) ,OUStringLiteral(PROPERTY_DETAILFIELDS)
,OUString(PROPERTY_PREVIEW_COUNT) ,OUStringLiteral(PROPERTY_PREVIEW_COUNT)
}; };
for (const OUString & rName : s_pProperties) for (const auto & rName : s_pProperties)
{ {
aValue.Name = rName; aValue.Name = rName;
aNewProps.push_back(aValue); aNewProps.push_back(aValue);

View File

@ -232,61 +232,61 @@ namespace rptui
void OPropertyInfoService::getExcludeProperties(::std::vector< beans::Property >& _rExcludeProperties,const css::uno::Reference< css::inspection::XPropertyHandler >& _xFormComponentHandler) void OPropertyInfoService::getExcludeProperties(::std::vector< beans::Property >& _rExcludeProperties,const css::uno::Reference< css::inspection::XPropertyHandler >& _xFormComponentHandler)
{ {
uno::Sequence< beans::Property > aProps = _xFormComponentHandler->getSupportedProperties(); uno::Sequence< beans::Property > aProps = _xFormComponentHandler->getSupportedProperties();
static const OUString pExcludeProperties[] = static const OUStringLiteral pExcludeProperties[] =
{ {
OUString("Enabled"), OUStringLiteral("Enabled"),
OUString("Printable"), OUStringLiteral("Printable"),
OUString("WordBreak"), OUStringLiteral("WordBreak"),
OUString("MultiLine"), OUStringLiteral("MultiLine"),
OUString("Tag"), OUStringLiteral("Tag"),
OUString("HelpText"), OUStringLiteral("HelpText"),
OUString("HelpURL"), OUStringLiteral("HelpURL"),
OUString("MaxTextLen"), OUStringLiteral("MaxTextLen"),
OUString("ReadOnly"), OUStringLiteral("ReadOnly"),
OUString("Tabstop"), OUStringLiteral("Tabstop"),
OUString("TabIndex"), OUStringLiteral("TabIndex"),
OUString("ValueMin"), OUStringLiteral("ValueMin"),
OUString("ValueMax"), OUStringLiteral("ValueMax"),
OUString("Spin"), OUStringLiteral("Spin"),
OUString("SpinValue"), OUStringLiteral("SpinValue"),
OUString("SpinValueMin"), OUStringLiteral("SpinValueMin"),
OUString("SpinValueMax"), OUStringLiteral("SpinValueMax"),
OUString("DefaultSpinValue"), OUStringLiteral("DefaultSpinValue"),
OUString("SpinIncrement"), OUStringLiteral("SpinIncrement"),
OUString("Repeat"), OUStringLiteral("Repeat"),
OUString("RepeatDelay"), OUStringLiteral("RepeatDelay"),
OUString("ControlLabel"), /// TODO: has to be checked OUStringLiteral("ControlLabel"), /// TODO: has to be checked
OUString("LabelControl"), OUStringLiteral("LabelControl"),
OUString("Title"), // comment this out if you want to have title feature for charts OUStringLiteral("Title"), // comment this out if you want to have title feature for charts
OUString(PROPERTY_MAXTEXTLEN), OUStringLiteral(PROPERTY_MAXTEXTLEN),
OUString(PROPERTY_EFFECTIVEDEFAULT), OUStringLiteral(PROPERTY_EFFECTIVEDEFAULT),
OUString(PROPERTY_EFFECTIVEMAX), OUStringLiteral(PROPERTY_EFFECTIVEMAX),
OUString(PROPERTY_EFFECTIVEMIN), OUStringLiteral(PROPERTY_EFFECTIVEMIN),
OUString("HideInactiveSelection"), OUStringLiteral("HideInactiveSelection"),
OUString("SubmitAction"), OUStringLiteral("SubmitAction"),
OUString("InputRequired"), OUStringLiteral("InputRequired"),
OUString("VerticalAlign"), OUStringLiteral("VerticalAlign"),
OUString(PROPERTY_ALIGN), OUStringLiteral(PROPERTY_ALIGN),
OUString(PROPERTY_EMPTY_IS_NULL), OUStringLiteral(PROPERTY_EMPTY_IS_NULL),
OUString(PROPERTY_FILTERPROPOSAL) OUStringLiteral(PROPERTY_FILTERPROPOSAL)
,OUString(PROPERTY_POSITIONX) ,OUStringLiteral(PROPERTY_POSITIONX)
,OUString(PROPERTY_POSITIONY) ,OUStringLiteral(PROPERTY_POSITIONY)
,OUString(PROPERTY_WIDTH) ,OUStringLiteral(PROPERTY_WIDTH)
,OUString(PROPERTY_HEIGHT) ,OUStringLiteral(PROPERTY_HEIGHT)
,OUString(PROPERTY_FONT) ,OUStringLiteral(PROPERTY_FONT)
,OUString(PROPERTY_LABEL) ,OUStringLiteral(PROPERTY_LABEL)
,OUString(PROPERTY_LINECOLOR) ,OUStringLiteral(PROPERTY_LINECOLOR)
,OUString(PROPERTY_BORDER) ,OUStringLiteral(PROPERTY_BORDER)
,OUString(PROPERTY_BORDERCOLOR) ,OUStringLiteral(PROPERTY_BORDERCOLOR)
,OUString(PROPERTY_BACKTRANSPARENT) ,OUStringLiteral(PROPERTY_BACKTRANSPARENT)
,OUString(PROPERTY_CONTROLBACKGROUND) ,OUStringLiteral(PROPERTY_CONTROLBACKGROUND)
,OUString(PROPERTY_BACKGROUNDCOLOR) ,OUStringLiteral(PROPERTY_BACKGROUNDCOLOR)
,OUString(PROPERTY_CONTROLBACKGROUNDTRANSPARENT) ,OUStringLiteral(PROPERTY_CONTROLBACKGROUNDTRANSPARENT)
,OUString(PROPERTY_FORMULALIST) ,OUStringLiteral(PROPERTY_FORMULALIST)
,OUString(PROPERTY_SCOPE) ,OUStringLiteral(PROPERTY_SCOPE)
,OUString(PROPERTY_TYPE) ,OUStringLiteral(PROPERTY_TYPE)
,OUString(PROPERTY_DATASOURCENAME) ,OUStringLiteral(PROPERTY_DATASOURCENAME)
,OUString(PROPERTY_VERTICALALIGN) ,OUStringLiteral(PROPERTY_VERTICALALIGN)
}; };
beans::Property* pPropsIter = aProps.getArray(); beans::Property* pPropsIter = aProps.getArray();

View File

@ -2069,15 +2069,15 @@ void OReportController::onLoadedMenu(const Reference< frame::XLayoutManager >& _
{ {
if ( _xLayoutManager.is() ) if ( _xLayoutManager.is() )
{ {
static const OUString s_sMenu[] = { static const OUStringLiteral s_sMenu[] = {
OUString("private:resource/statusbar/statusbar") OUStringLiteral("private:resource/statusbar/statusbar")
,OUString("private:resource/toolbar/reportcontrols") ,OUStringLiteral("private:resource/toolbar/reportcontrols")
,OUString("private:resource/toolbar/drawbar") ,OUStringLiteral("private:resource/toolbar/drawbar")
,OUString("private:resource/toolbar/Formatting") ,OUStringLiteral("private:resource/toolbar/Formatting")
,OUString("private:resource/toolbar/alignmentbar") ,OUStringLiteral("private:resource/toolbar/alignmentbar")
,OUString("private:resource/toolbar/sectionalignmentbar") ,OUStringLiteral("private:resource/toolbar/sectionalignmentbar")
,OUString("private:resource/toolbar/resizebar") ,OUStringLiteral("private:resource/toolbar/resizebar")
,OUString("private:resource/toolbar/sectionshrinkbar") ,OUStringLiteral("private:resource/toolbar/sectionshrinkbar")
}; };
for (const auto & i : s_sMenu) 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) css::uno::Sequence< OUString > SAL_CALL OReportController::getSupportedModes( ) throw (css::uno::RuntimeException, std::exception)
{ {
static const OUString s_sModes[] = { OUString("remote"), return uno::Sequence< OUString> { OUString("remote"), OUString("normal") };
OUString("normal") };
return uno::Sequence< OUString> (&s_sModes[0],SAL_N_ELEMENTS(s_sModes));
} }
sal_Bool SAL_CALL OReportController::supportsMode( const OUString& aMode ) throw (css::uno::RuntimeException, std::exception) sal_Bool SAL_CALL OReportController::supportsMode( const OUString& aMode ) throw (css::uno::RuntimeException, std::exception)
{ {

View File

@ -67,9 +67,9 @@
#endif #endif
#if defined(_WIN32) #if defined(_WIN32)
const rtl::OUString EXECUTABLE_NAME ("osl_process_child.exe"); const rtl::OUStringLiteral EXECUTABLE_NAME ("osl_process_child.exe");
#else #else
const rtl::OUString EXECUTABLE_NAME ("osl_process_child"); const rtl::OUStringLiteral EXECUTABLE_NAME ("osl_process_child");
#endif #endif
using namespace osl; using namespace osl;

View File

@ -23,33 +23,33 @@
using namespace ::ooo::vba; using namespace ::ooo::vba;
using namespace ::com::sun::star; using namespace ::com::sun::star;
static const OUString aStringList[]= static const OUStringLiteral aStringList[]=
{ {
OUString( ".uno:Open" ), OUStringLiteral( ".uno:Open" ),
OUString( ".uno:FormatCellDialog" ), OUStringLiteral( ".uno:FormatCellDialog" ),
OUString( ".uno:InsertCell" ), OUStringLiteral( ".uno:InsertCell" ),
OUString( ".uno:Print" ), OUStringLiteral( ".uno:Print" ),
OUString( ".uno:PasteSpecial" ), OUStringLiteral( ".uno:PasteSpecial" ),
OUString( ".uno:ToolProtectionDocument" ), OUStringLiteral( ".uno:ToolProtectionDocument" ),
OUString( ".uno:ColumnWidth" ), OUStringLiteral( ".uno:ColumnWidth" ),
OUString( ".uno:DefineName" ), OUStringLiteral( ".uno:DefineName" ),
OUString( ".uno:ConfigureDialog" ), OUStringLiteral( ".uno:ConfigureDialog" ),
OUString( ".uno:HyperlinkDialog" ), OUStringLiteral( ".uno:HyperlinkDialog" ),
OUString( ".uno:InsertGraphic" ), OUStringLiteral( ".uno:InsertGraphic" ),
OUString( ".uno:InsertObject" ), OUStringLiteral( ".uno:InsertObject" ),
OUString( ".uno:PageFormatDialog" ), OUStringLiteral( ".uno:PageFormatDialog" ),
OUString( ".uno:DataSort" ), OUStringLiteral( ".uno:DataSort" ),
OUString( ".uno:RowHeight" ), OUStringLiteral( ".uno:RowHeight" ),
OUString( ".uno:AutoCorrectDlg" ), OUStringLiteral( ".uno:AutoCorrectDlg" ),
OUString( ".uno:ConditionalFormatDialog" ), OUStringLiteral( ".uno:ConditionalFormatDialog" ),
OUString( ".uno:DataConsolidate" ), OUStringLiteral( ".uno:DataConsolidate" ),
OUString( ".uno:CreateNames" ), OUStringLiteral( ".uno:CreateNames" ),
OUString( ".uno:FillSeries" ), OUStringLiteral( ".uno:FillSeries" ),
OUString( ".uno:Validation"), OUStringLiteral( ".uno:Validation"),
OUString( ".uno:DefineLabelRange" ), OUStringLiteral( ".uno:DefineLabelRange" ),
OUString( ".uno:DataFilterAutoFilter" ), OUStringLiteral( ".uno:DataFilterAutoFilter" ),
OUString( ".uno:DataFilterSpecialFilter" ), OUStringLiteral( ".uno:DataFilterSpecialFilter" ),
OUString( ".uno:AutoFormat" ) OUStringLiteral( ".uno:AutoFormat" )
}; };
const sal_Int32 nDialogSize = SAL_N_ELEMENTS(aStringList); const sal_Int32 nDialogSize = SAL_N_ELEMENTS(aStringList);

View File

@ -422,11 +422,10 @@ uno::Sequence< OUString> SAL_CALL
{ {
ThrowIfDisposed (); ThrowIfDisposed ();
static const OUString sServiceNames[2] = { return uno::Sequence<OUString> {
OUString("com.sun.star.accessibility.Accessible"), OUString("com.sun.star.accessibility.Accessible"),
OUString("com.sun.star.accessibility.AccessibleContext") OUString("com.sun.star.accessibility.AccessibleContext")
}; };
return uno::Sequence<OUString> (sServiceNames, 2);
} }
void AccessibleSlideSorterObject::ThrowIfDisposed() void AccessibleSlideSorterObject::ThrowIfDisposed()

View File

@ -636,12 +636,11 @@ uno::Sequence< OUString> SAL_CALL
{ {
ThrowIfDisposed (); ThrowIfDisposed ();
static const OUString sServiceNames[3] = { return uno::Sequence<OUString> {
OUString("com.sun.star.accessibility.Accessible"), OUString("com.sun.star.accessibility.Accessible"),
OUString("com.sun.star.accessibility.AccessibleContext"), OUString("com.sun.star.accessibility.AccessibleContext"),
OUString("com.sun.star.drawing.AccessibleSlideSorterView") OUString("com.sun.star.drawing.AccessibleSlideSorterView")
}; };
return uno::Sequence<OUString> (sServiceNames, 3);
} }
void AccessibleSlideSorterView::ThrowIfDisposed() void AccessibleSlideSorterView::ThrowIfDisposed()

View File

@ -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 nBitmapWidth = (nCellWidth * nPreviewColumns) - (nPreviewColumns - 1);
static const sal_Int32 nBitmapHeight = (nCellHeight * nPreviewRows) - (nPreviewRows - 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 ] = OUStringLiteral("UseFirstRowStyle") ,
{ OUStringLiteral("UseLastRowStyle") ,
OUString("UseFirstRowStyle") , OUStringLiteral("UseBandingRowStyle") ,
OUString("UseLastRowStyle") , OUStringLiteral("UseFirstColumnStyle") ,
OUString("UseBandingRowStyle") , OUStringLiteral("UseLastColumnStyle") ,
OUString("UseFirstColumnStyle") , OUStringLiteral("UseBandingColumnStyle")
OUString("UseLastColumnStyle") , };
OUString("UseBandingColumnStyle")
};
return &gPropNames[0];
}
TableDesignWidget::TableDesignWidget( VclBuilderContainer* pParent, ViewShellBase& rBase, bool bModal ) TableDesignWidget::TableDesignWidget( VclBuilderContainer* pParent, ViewShellBase& rBase, bool bModal )
: mrBase(rBase) : mrBase(rBase)
@ -112,10 +108,9 @@ TableDesignWidget::TableDesignWidget( VclBuilderContainer* pParent, ViewShellBas
} }
m_pValueSet->SetSelectHdl (LINK(this, TableDesignWidget, implValueSetHdl)); m_pValueSet->SetSelectHdl (LINK(this, TableDesignWidget, implValueSetHdl));
const OUString* pPropNames = getPropertyNames();
for (sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i) 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 ) ); 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 }; static const bool gDefaults[CB_COUNT] = { true, false, true, false, false, false };
const bool bHasTable = mxSelectedTable.is(); const bool bHasTable = mxSelectedTable.is();
const OUString* pPropNames = getPropertyNames();
for (sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i) for (sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i)
{ {
bool bUse = gDefaults[i]; bool bUse = gDefaults[i];
if( bHasTable ) try if( bHasTable ) try
{ {
mxSelectedTable->getPropertyValue( *pPropNames++ ) >>= bUse; mxSelectedTable->getPropertyValue( gPropNames[i] ) >>= bUse;
} }
catch( Exception& ) catch( Exception& )
{ {

View File

@ -30,15 +30,15 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
const OUString RECENTLY_USED_FILE_NAME(".recently-used"); const OUStringLiteral RECENTLY_USED_FILE_NAME(".recently-used");
const OUString SLASH("/"); const char SLASH[] = "/";
namespace /* private */ { namespace /* private */ {
inline void ensure_final_slash(/*inout*/ OUString& path) inline void ensure_final_slash(/*inout*/ OUString& path)
{ {
if (!path.isEmpty() && if (!path.isEmpty() &&
(SLASH.pData->buffer[0] != path.pData->buffer[path.getLength() - 1])) (SLASH[0] != path.pData->buffer[path.getLength() - 1]))
path += SLASH; path += SLASH;
} }

View File

@ -51,8 +51,6 @@ using namespace ::com::sun::star::uno ;
#define PROPERTYHANDLE_SHOWICONSINMENUES 2 #define PROPERTYHANDLE_SHOWICONSINMENUES 2
#define PROPERTYHANDLE_SYSTEMICONSINMENUES 3 #define PROPERTYHANDLE_SYSTEMICONSINMENUES 3
#define PROPERTYCOUNT 4
#include <tools/link.hxx> #include <tools/link.hxx>
// private declarations! // private declarations!
@ -301,17 +299,12 @@ void SvtMenuOptions_Impl::ImplCommit()
Sequence< OUString > const & SvtMenuOptions_Impl::impl_GetPropertyNames() Sequence< OUString > const & SvtMenuOptions_Impl::impl_GetPropertyNames()
{ {
// Build static list of configuration key names. static const Sequence<OUString> seqPropertyNames {
static const OUString pProperties[] =
{
OUString(PROPERTYNAME_DONTHIDEDISABLEDENTRIES) , OUString(PROPERTYNAME_DONTHIDEDISABLEDENTRIES) ,
OUString(PROPERTYNAME_FOLLOWMOUSE) , OUString(PROPERTYNAME_FOLLOWMOUSE) ,
OUString(PROPERTYNAME_SHOWICONSINMENUES) , OUString(PROPERTYNAME_SHOWICONSINMENUES) ,
OUString(PROPERTYNAME_SYSTEMICONSINMENUES) OUString(PROPERTYNAME_SYSTEMICONSINMENUES)
}; };
// Initialize return sequence with these list ...
static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
// ... and return it.
return seqPropertyNames; return seqPropertyNames;
} }

View File

@ -1594,24 +1594,22 @@ Reference< XIndexContainer > FmXGridPeer::getColumns() throw( RuntimeException,
void FmXGridPeer::addColumnListeners(const Reference< XPropertySet >& xCol) 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 // as not all properties have to be supported by all columns we have to check this
// before adding a listener // before adding a listener
Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo(); Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo();
Property aPropDesc; for (unsigned i=0; i<SAL_N_ELEMENTS(aPropsListenedTo); ++i)
const OUString* pProps = aPropsListenedTo;
const OUString* pPropsEnd = pProps + SAL_N_ELEMENTS( aPropsListenedTo );
for (; pProps != pPropsEnd; ++pProps)
{ {
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 ) ) 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 // the same props as in addColumnListeners ... linux has problems with global static UStrings, so
// we have to do it this way .... // 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(); Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo();

View File

@ -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 ) ::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), OUStringLiteral(FM_SUN_COMPONENT_TEXTFIELD),
OUString(FM_SUN_COMPONENT_FORM), OUStringLiteral(FM_SUN_COMPONENT_FORM),
OUString(FM_SUN_COMPONENT_LISTBOX), OUStringLiteral(FM_SUN_COMPONENT_LISTBOX),
OUString(FM_SUN_COMPONENT_COMBOBOX), OUStringLiteral(FM_SUN_COMPONENT_COMBOBOX),
OUString(FM_SUN_COMPONENT_RADIOBUTTON), OUStringLiteral(FM_SUN_COMPONENT_RADIOBUTTON),
OUString(FM_SUN_COMPONENT_GROUPBOX), OUStringLiteral(FM_SUN_COMPONENT_GROUPBOX),
OUString(FM_SUN_COMPONENT_FIXEDTEXT), OUStringLiteral(FM_SUN_COMPONENT_FIXEDTEXT),
OUString(FM_SUN_COMPONENT_COMMANDBUTTON), OUStringLiteral(FM_SUN_COMPONENT_COMMANDBUTTON),
OUString(FM_SUN_COMPONENT_CHECKBOX), OUStringLiteral(FM_SUN_COMPONENT_CHECKBOX),
OUString(FM_SUN_COMPONENT_GRIDCONTROL), OUStringLiteral(FM_SUN_COMPONENT_GRIDCONTROL),
OUString(FM_SUN_COMPONENT_IMAGEBUTTON), OUStringLiteral(FM_SUN_COMPONENT_IMAGEBUTTON),
OUString(FM_SUN_COMPONENT_FILECONTROL), OUStringLiteral(FM_SUN_COMPONENT_FILECONTROL),
OUString(FM_SUN_COMPONENT_TIMEFIELD), OUStringLiteral(FM_SUN_COMPONENT_TIMEFIELD),
OUString(FM_SUN_COMPONENT_DATEFIELD), OUStringLiteral(FM_SUN_COMPONENT_DATEFIELD),
OUString(FM_SUN_COMPONENT_NUMERICFIELD), OUStringLiteral(FM_SUN_COMPONENT_NUMERICFIELD),
OUString(FM_SUN_COMPONENT_CURRENCYFIELD), OUStringLiteral(FM_SUN_COMPONENT_CURRENCYFIELD),
OUString(FM_SUN_COMPONENT_PATTERNFIELD), OUStringLiteral(FM_SUN_COMPONENT_PATTERNFIELD),
OUString(FM_SUN_COMPONENT_HIDDENCONTROL), OUStringLiteral(FM_SUN_COMPONENT_HIDDENCONTROL),
OUString(FM_SUN_COMPONENT_IMAGECONTROL) OUStringLiteral(FM_SUN_COMPONENT_IMAGECONTROL)
}; };
static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList); static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList);

View File

@ -535,13 +535,13 @@ void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt)
return; return;
// if it's a "default value" property of a control model, set the according "value" property // if it's a "default value" property of a control model, set the according "value" property
static const OUString pDefaultValueProperties[] = { static const OUStringLiteral pDefaultValueProperties[] = {
OUString(FM_PROP_DEFAULT_TEXT), OUString(FM_PROP_DEFAULTCHECKED), OUString(FM_PROP_DEFAULT_DATE), OUString(FM_PROP_DEFAULT_TIME), OUStringLiteral(FM_PROP_DEFAULT_TEXT), OUStringLiteral(FM_PROP_DEFAULTCHECKED), OUStringLiteral(FM_PROP_DEFAULT_DATE), OUStringLiteral(FM_PROP_DEFAULT_TIME),
OUString(FM_PROP_DEFAULT_VALUE), OUString(FM_PROP_DEFAULT_SELECT_SEQ), OUString(FM_PROP_EFFECTIVE_DEFAULT) OUStringLiteral(FM_PROP_DEFAULT_VALUE), OUStringLiteral(FM_PROP_DEFAULT_SELECT_SEQ), OUStringLiteral(FM_PROP_EFFECTIVE_DEFAULT)
}; };
const OUString aValueProperties[] = { static const OUStringLiteral aValueProperties[] = {
OUString(FM_PROP_TEXT), OUString(FM_PROP_STATE), OUString(FM_PROP_DATE), OUString(FM_PROP_TIME), OUStringLiteral(FM_PROP_TEXT), OUStringLiteral(FM_PROP_STATE), OUStringLiteral(FM_PROP_DATE), OUStringLiteral(FM_PROP_TIME),
OUString(FM_PROP_VALUE), OUString(FM_PROP_SELECT_SEQ), OUString(FM_PROP_EFFECTIVE_VALUE) OUStringLiteral(FM_PROP_VALUE), OUStringLiteral(FM_PROP_SELECT_SEQ), OUStringLiteral(FM_PROP_EFFECTIVE_VALUE)
}; };
sal_Int32 nDefaultValueProps = SAL_N_ELEMENTS(pDefaultValueProperties); sal_Int32 nDefaultValueProps = SAL_N_ELEMENTS(pDefaultValueProperties);
OSL_ENSURE(SAL_N_ELEMENTS(aValueProperties) == nDefaultValueProps, OSL_ENSURE(SAL_N_ELEMENTS(aValueProperties) == nDefaultValueProps,

View File

@ -896,9 +896,9 @@ void SwUiWriterTest::testCommentedWord()
// Chinese conversion tests // Chinese conversion tests
static const OUString CHINESE_TRADITIONAL_CONTENT(sal_Unicode(0x9F8D)); static const sal_Unicode CHINESE_TRADITIONAL_CONTENT(0x9F8D);
static const OUString CHINESE_SIMPLIFIED_CONTENT(sal_Unicode(0x9F99)); static const sal_Unicode CHINESE_SIMPLIFIED_CONTENT(0x9F99);
static const OUString NON_CHINESE_CONTENT ("Hippopotamus"); static const OUStringLiteral NON_CHINESE_CONTENT("Hippopotamus");
// Tests that a blank document is still blank after conversion // Tests that a blank document is still blank after conversion
void SwUiWriterTest::testChineseConversionBlank() void SwUiWriterTest::testChineseConversionBlank()
@ -943,7 +943,7 @@ void SwUiWriterTest::testChineseConversionNonChineseText()
// Then // Then
SwTextNode* pTextNode = aPaM.GetNode().GetTextNode(); 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() ); const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
SwPaM aPaM(aIdx); SwPaM aPaM(aIdx);
pDoc->getIDocumentContentOperations().InsertString(aPaM, CHINESE_TRADITIONAL_CONTENT); pDoc->getIDocumentContentOperations().InsertString(aPaM, OUString(CHINESE_TRADITIONAL_CONTENT));
// When // When
SwHHCWrapper aWrap( pView, xContext, LANGUAGE_CHINESE_TRADITIONAL, LANGUAGE_CHINESE_SIMPLIFIED, nullptr, SwHHCWrapper aWrap( pView, xContext, LANGUAGE_CHINESE_TRADITIONAL, LANGUAGE_CHINESE_SIMPLIFIED, nullptr,
@ -967,7 +967,7 @@ void SwUiWriterTest::testChineseConversionTraditionalToSimplified()
// Then // Then
SwTextNode* pTextNode = aPaM.GetNode().GetTextNode(); 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() ); const uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
SwPaM aPaM(aIdx); SwPaM aPaM(aIdx);
pDoc->getIDocumentContentOperations().InsertString(aPaM, CHINESE_SIMPLIFIED_CONTENT); pDoc->getIDocumentContentOperations().InsertString(aPaM, OUString(CHINESE_SIMPLIFIED_CONTENT));
// When // When
SwHHCWrapper aWrap( pView, xContext, LANGUAGE_CHINESE_SIMPLIFIED, LANGUAGE_CHINESE_TRADITIONAL, nullptr, SwHHCWrapper aWrap( pView, xContext, LANGUAGE_CHINESE_SIMPLIFIED, LANGUAGE_CHINESE_TRADITIONAL, nullptr,
@ -991,7 +991,7 @@ void SwUiWriterTest::testChineseConversionSimplifiedToTraditional()
// Then // Then
SwTextNode* pTextNode = aPaM.GetNode().GetTextNode(); SwTextNode* pTextNode = aPaM.GetNode().GetTextNode();
CPPUNIT_ASSERT_EQUAL(CHINESE_TRADITIONAL_CONTENT, pTextNode->GetText()); CPPUNIT_ASSERT_EQUAL(OUString(CHINESE_TRADITIONAL_CONTENT), pTextNode->GetText());
} }

View File

@ -163,7 +163,7 @@ IconThemeSelectorTest::FallbackThemeIsReturnedForEmptyInput()
vcl::IconThemeSelector s; vcl::IconThemeSelector s;
OUString selected = s.SelectIconTheme(std::vector<vcl::IconThemeInfo>(), "oxygen"); OUString selected = s.SelectIconTheme(std::vector<vcl::IconThemeInfo>(), "oxygen");
CPPUNIT_ASSERT_EQUAL_MESSAGE("fallback is returned for empty input", 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 void

View File

@ -16,13 +16,13 @@
// constants for theme ids and display names. Only the theme id for hicontrast is used // constants for theme ids and display names. Only the theme id for hicontrast is used
// outside of this class and hence made public. // 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 { namespace {
static const OUString HIGH_CONTRAST_DISPLAY_NAME = "High Contrast"; static const OUStringLiteral HIGH_CONTRAST_DISPLAY_NAME("High Contrast");
static const OUString TANGO_TESTING_ID = "tango_testing"; static const OUStringLiteral TANGO_TESTING_ID("tango_testing");
static const OUString TANGO_TESTING_DISPLAY_NAME = "Tango Testing"; static const OUStringLiteral TANGO_TESTING_DISPLAY_NAME("Tango Testing");
OUString OUString
filename_from_url(const OUString& url) filename_from_url(const OUString& url)

View File

@ -16,8 +16,7 @@
namespace vcl { namespace vcl {
/*static*/ const OUString /*static*/ const OUStringLiteral IconThemeSelector::FALLBACK_ICON_THEME_ID("tango");
IconThemeSelector::FALLBACK_ICON_THEME_ID("tango");
namespace { namespace {