diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-03 14:03:54 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-05 08:44:19 +0200 |
commit | 705c48d32eec0aa5180e60ca157daca4b154e4a3 (patch) | |
tree | 97f43496f4b429a2b8d03b1e71cb2a1c33142a15 /dbaccess | |
parent | b7d8a58ff2698ffc6e22943f64aa97c5ea253bd9 (diff) |
fdo#38835 strip out OUString globals
they are largely unnecessary these days, since our OUString infrastructure
gained optimised handling for static char constants.
Change-Id: I07f73484f82d0582252cb4324d4107c998432c37
Diffstat (limited to 'dbaccess')
29 files changed, 117 insertions, 194 deletions
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx index de9d9434db47..9df83208c190 100644 --- a/dbaccess/source/core/api/CacheSet.cxx +++ b/dbaccess/source/core/api/CacheSet.cxx @@ -157,9 +157,9 @@ void SAL_CALL OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connecti // set values and column names OUStringBuffer aValues(" VALUES ( "); - static OUString aPara("?,"); + static const char aPara[] = "?,"; OUString aQuote = getIdentifierQuoteString(); - static OUString aComma(","); + static const char aComma[] = ","; sal_Int32 i = 1; ORowVector< ORowSetValue >::Vector::const_iterator aIter = _rInsertRow->get().begin()+1; connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end(); @@ -227,8 +227,8 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow OUString aColumnName; - static OUString aPara("?,"); - static OUString aAnd(" AND "); + static const char aPara[] = "?,"; + static const char aAnd[] = " AND "; OUString aQuote = getIdentifierQuoteString(); diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx index 122182bdf1d0..3fa7078257e9 100644 --- a/dbaccess/source/core/api/FilteredContainer.cxx +++ b/dbaccess/source/core/api/FilteredContainer.cxx @@ -344,7 +344,7 @@ sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, ::std::vecto } } - static const OUString sAll("%"); + static const char sAll[] = "%"; Reference< XResultSet > xTables = m_xMetaData->getTables( Any(), sAll, sAll, aTableTypeFilter ); Reference< XRow > xCurrentRow( xTables, UNO_QUERY_THROW ); diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 28b797671137..9992c15ca227 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -221,7 +221,7 @@ namespace { void appendOneKeyColumnClause( const OUString &tblName, const OUString &colName, const connectivity::ORowSetValue &_rValue, OUStringBuffer &o_buf ) { - static const OUString s_sDot("."); + static const char s_sDot[] = "."; OUString fullName; if (tblName.isEmpty()) fullName = colName; @@ -255,7 +255,7 @@ OUStringBuffer OKeySet::createKeyFilter() { connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.first->get().begin(); - static const OUString aAnd(" AND "); + static const char aAnd[] = " AND "; const OUString aQuote = getIdentifierQuoteString(); OUStringBuffer aFilter; // create the where clause @@ -471,9 +471,9 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows // list all columns that should be set const OUString aQuote = getIdentifierQuoteString(); - static OUString aAnd(" AND "); - static OUString aOr(" OR "); - static OUString aEqual(" = ?"); + static const char aAnd[] = " AND "; + static const char aOr[] = " OR "; + static const char aEqual[] = " = ?"; // use keys for exact positioning Reference<XNameAccess> xKeyColumns = getKeyColumns(); @@ -486,7 +486,7 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const Sequence< Any >& rows { aCondition.append(::dbtools::quoteName( aQuote,aIter->second.sRealName) + aEqual + aAnd); } - aCondition.setLength(aCondition.getLength() - aAnd.getLength()); + aCondition.setLength(aCondition.getLength() - strlen(aAnd)); // sCon is (parenthesised) the condition to locate ONE row // e.g. ( colName1 = ? AND colName2 = ? AND colName3 = ? ) const OUString sCon( aCondition.makeStringAndClear() ); @@ -728,9 +728,9 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi // set values and column names OUStringBuffer aValues(" VALUES ( "); - static OUString aPara("?,"); + static const char aPara[] = "?,"; OUString aQuote = getIdentifierQuoteString(); - static OUString aComma(","); + static const char aComma[] = ","; SelectColumnsMetaData::const_iterator aIter = m_pColumnNames->begin(); SelectColumnsMetaData::const_iterator aEnd = m_pColumnNames->end(); @@ -967,7 +967,7 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivit // list all columns that should be set OUString aQuote = getIdentifierQuoteString(); - static OUString aAnd(" AND "); + static const char aAnd[] = " AND "; // use keys and indexes for exact positioning Reference<XNameAccess> xKeyColumns = getKeyColumns(); diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index 69cfa7d6530f..d3a32358b130 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -179,7 +179,7 @@ void SAL_CALL OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORow if ( m_aJoinedKeyColumns.empty() ) throw SQLException(); // list all columns that should be set - static OUString s_sPara(" = ?"); + static const char s_sPara[] = " = ?"; OUString aQuote = getIdentifierQuoteString(); ::std::map< OUString,bool > aResultSetChanged; @@ -223,8 +223,8 @@ void SAL_CALL OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORow if( aKeyConditions.empty() ) ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_CONDITION_FOR_PK ), SQL_GENERAL_ERROR, m_xConnection ); - static const OUString s_sUPDATE("UPDATE "); - static const OUString s_sSET(" SET "); + static const char s_sUPDATE[] = "UPDATE "; + static const char s_sSET[] = " SET "; Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData(); @@ -291,8 +291,8 @@ void SAL_CALL OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const conn ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_VALUE_CHANGED ), SQL_GENERAL_ERROR, m_xConnection ); Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData(); - static const OUString s_sINSERT("INSERT INTO "); - static const OUString s_sVALUES(") VALUES ( "); + static const char s_sINSERT[] = "INSERT INTO "; + static const char s_sVALUES[] = ") VALUES ( "; TSQLStatements::iterator aSqlIter = aSql.begin(); TSQLStatements::iterator aSqlEnd = aSql.end(); for(;aSqlIter != aSqlEnd ; ++aSqlIter) diff --git a/dbaccess/source/core/api/View.cxx b/dbaccess/source/core/api/View.cxx index 2cf497bf8fc8..4ec165dc3482 100644 --- a/dbaccess/source/core/api/View.cxx +++ b/dbaccess/source/core/api/View.cxx @@ -64,7 +64,7 @@ namespace dbaccess try { Reference<XMultiServiceFactory> xFac(_rxConnection,UNO_QUERY_THROW); - static const OUString s_sViewAccess("ViewAccessServiceName"); + static const char s_sViewAccess[] = "ViewAccessServiceName"; m_xViewAccess.set(xFac->createInstance(lcl_getServiceNameForSetting(_rxConnection,s_sViewAccess)),UNO_QUERY); } catch(const Exception& ) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index c520f92b60f9..993262befa25 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -367,7 +367,7 @@ namespace } } -static OUString sPictures( "Pictures" ); +static const char sPictures[] = "Pictures"; // base documents seem to have a different behaviour to other documents, the // root storage contents at least seem to be re-used over different saves, thus if there is a diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.cxx b/dbaccess/source/core/dataaccess/databaseregistrations.cxx index 4b7f7026f6e2..7039a1abba43 100644 --- a/dbaccess/source/core/dataaccess/databaseregistrations.cxx +++ b/dbaccess/source/core/dataaccess/databaseregistrations.cxx @@ -52,22 +52,19 @@ namespace dbaccess using ::com::sun::star::sdb::DatabaseRegistrationEvent; using ::com::sun::star::uno::XAggregation; - static const OUString& getConfigurationRootPath() + static OUString getConfigurationRootPath() { - static OUString s_sNodeName("org.openoffice.Office.DataAccess/RegisteredNames"); - return s_sNodeName; + return OUString("org.openoffice.Office.DataAccess/RegisteredNames"); } - const OUString& getLocationNodeName() + static OUString getLocationNodeName() { - static OUString s_sNodeName("Location"); - return s_sNodeName; + return OUString("Location"); } - const OUString& getNameNodeName() + static OUString getNameNodeName() { - static OUString s_sNodeName("Name"); - return s_sNodeName; + return OUString("Name"); } // DatabaseRegistrations - declaration diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 28c334906215..be531a4f41da 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -218,7 +218,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments bool bNew = sPersistentName.isEmpty(); if ( bNew ) { - const static OUString sBaseName("Obj"); + static const char sBaseName[] = "Obj"; sPersistentName = sBaseName; sPersistentName += OUString::number(rDefinitions.size() + 1); diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 7573bef2f10a..d72667c024f7 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1365,7 +1365,7 @@ bool ODocumentDefinition::saveAs() try { Reference< XStorage> xStorage = getContainerStorage(); - const static OUString sBaseName("Obj"); + static const char sBaseName[] = "Obj"; OUString sPersistentName = ::dbtools::createUniqueName(xStorage,sBaseName); xStorage->copyElementTo(m_pImpl->m_aProps.sPersistentName,xStorage,sPersistentName); diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index 19e800ce1840..d0309308be96 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -293,7 +293,7 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::cre osl::MutexGuard g(m_aMutex); uno::Reference< chart2::data::XDataSequence > xData = m_xInternal->createDataSequenceByRangeRepresentation(_sRangeRepresentation); uno::Reference<beans::XPropertySet> xProp(xData,uno::UNO_QUERY); - const static OUString s_sNumberFormatKey("NumberFormatKey"); + static const char s_sNumberFormatKey[] = "NumberFormatKey"; if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(s_sNumberFormatKey) ) { xProp->setPropertyValue(s_sNumberFormatKey,impl_getNumberFormatKey_nothrow(_sRangeRepresentation)); diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index 4f7dfaf02c0d..c6b241971c95 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -298,17 +298,17 @@ bool ODsnTypeCollection::isEmbeddedDatabase( const OUString& _sURL ) const OUString ODsnTypeCollection::getEmbeddedDatabase() const { OUString sEmbeddedDatabaseURL; - static const OUString s_sNodeName("org.openoffice.Office.DataAccess"); ///Installed + static const char s_sNodeName[] = "org.openoffice.Office.DataAccess"; ///Installed const ::utl::OConfigurationTreeRoot aInstalled = ::utl::OConfigurationTreeRoot::createWithComponentContext(m_xContext, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY); if ( aInstalled.isValid() ) { if ( aInstalled.hasByName("EmbeddedDatabases/DefaultEmbeddedDatabase/Value") ) { - static const OUString s_sValue("EmbeddedDatabases/DefaultEmbeddedDatabase/Value"); + static const char s_sValue[] = "EmbeddedDatabases/DefaultEmbeddedDatabase/Value"; aInstalled.getNodeValue(s_sValue) >>= sEmbeddedDatabaseURL; if ( !sEmbeddedDatabaseURL.isEmpty() ) - aInstalled.getNodeValue(s_sValue + "/" + sEmbeddedDatabaseURL + "/URL") >>= sEmbeddedDatabaseURL; + aInstalled.getNodeValue(OUString(s_sValue) + "/" + sEmbeddedDatabaseURL + "/URL") >>= sEmbeddedDatabaseURL; } } if ( sEmbeddedDatabaseURL.isEmpty() ) diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx index 94cdb4942be4..d19ecac84aaf 100644 --- a/dbaccess/source/core/recovery/dbdocrecovery.cxx +++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx @@ -106,23 +106,9 @@ namespace dbaccess return true; } - static const OUString& lcl_getRecoveryDataSubStorageName() - { - static const OUString s_sRecDataStorName( "recovery" ); - return s_sRecDataStorName; - } + static const char sRecoveryDataSubStorageName[] = "recovery"; - static const OUString& lcl_getObjectMapStreamName() - { - static const OUString s_sObjectMapStreamName( "storage-component-map.ini" ); - return s_sObjectMapStreamName; - } - - static const OUString& lcl_getMapStreamEncodingName() - { - static const OUString s_sMapStreamEncodingName( "UTF-8" ); - return s_sMapStreamEncodingName; - } + static const char sObjectMapStreamName[] = "storage-component-map.ini"; static void lcl_writeObjectMap_throw( const Reference<XComponentContext> & i_rContext, const Reference< XStorage >& i_rStorage, const MapStringToCompDesc& i_mapStorageToCompDesc ) @@ -131,7 +117,7 @@ namespace dbaccess // nothing to do return; - StorageTextOutputStream aTextOutput( i_rContext, i_rStorage, lcl_getObjectMapStreamName() ); + StorageTextOutputStream aTextOutput( i_rContext, i_rStorage, sObjectMapStreamName ); aTextOutput.writeLine( "[storages]" ); @@ -171,17 +157,17 @@ namespace dbaccess MapStringToCompDesc& o_mapStorageToObjectName ) { ENSURE_OR_THROW( i_rStorage.is(), "invalid storage" ); - if ( !i_rStorage->hasByName( lcl_getObjectMapStreamName() ) ) + if ( !i_rStorage->hasByName( sObjectMapStreamName ) ) { // nothing to do, though suspicious OSL_FAIL( "lcl_readObjectMap_throw: if there's no map file, then there's expected to be no storage, too!" ); return; } Reference< XStream > xIniStream( i_rStorage->openStreamElement( - lcl_getObjectMapStreamName(), ElementModes::READ ), UNO_SET_THROW ); + sObjectMapStreamName, ElementModes::READ ), UNO_SET_THROW ); Reference< XTextInputStream2 > xTextInput = TextInputStream::create( i_rxContext ); - xTextInput->setEncoding( lcl_getMapStreamEncodingName() ); + xTextInput->setEncoding( "UTF-8" ); xTextInput->setInputStream( xIniStream->getInputStream() ); OUString sCurrentSection; @@ -258,9 +244,9 @@ namespace dbaccess ENSURE_OR_THROW( i_rTargetStorage.is(), "invalid document storage" ); // create a sub storage for recovery data - if ( i_rTargetStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) - i_rTargetStorage->removeElement( lcl_getRecoveryDataSubStorageName() ); - Reference< XStorage > xRecoveryStorage = i_rTargetStorage->openStorageElement( lcl_getRecoveryDataSubStorageName(), ElementModes::READWRITE ); + if ( i_rTargetStorage->hasByName( sRecoveryDataSubStorageName ) ) + i_rTargetStorage->removeElement( sRecoveryDataSubStorageName ); + Reference< XStorage > xRecoveryStorage = i_rTargetStorage->openStorageElement( sRecoveryDataSubStorageName, ElementModes::READWRITE ); // store recovery data for open sub components of the given controller(s) if ( !i_rControllers.empty() ) @@ -312,12 +298,12 @@ namespace dbaccess ENSURE_OR_THROW( i_rDocumentStorage.is(), "illegal document storage" ); Reference< XDatabaseDocumentUI > xDocumentUI( i_rTargetController, UNO_QUERY_THROW ); - if ( !i_rDocumentStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) + if ( !i_rDocumentStorage->hasByName( sRecoveryDataSubStorageName ) ) // that's allowed return; // the "recovery" sub storage - Reference< XStorage > xRecoveryStorage = i_rDocumentStorage->openStorageElement( lcl_getRecoveryDataSubStorageName(), ElementModes::READ ); + Reference< XStorage > xRecoveryStorage = i_rDocumentStorage->openStorageElement( sRecoveryDataSubStorageName, ElementModes::READ ); // read the map from sub storages to object names MapCompTypeToCompDescs aMapCompDescs; @@ -385,7 +371,7 @@ namespace dbaccess // now that we successfully recovered, removed the "recovery" sub storage try { - i_rDocumentStorage->removeElement( lcl_getRecoveryDataSubStorageName() ); + i_rDocumentStorage->removeElement( sRecoveryDataSubStorageName ); } catch( const Exception& ) { diff --git a/dbaccess/source/core/recovery/storagetextstream.cxx b/dbaccess/source/core/recovery/storagetextstream.cxx index 05822b651eee..6d5739837d50 100644 --- a/dbaccess/source/core/recovery/storagetextstream.cxx +++ b/dbaccess/source/core/recovery/storagetextstream.cxx @@ -49,21 +49,7 @@ namespace dbaccess Reference< XTextOutputStream2 > xTextOutput; }; - // helper - namespace - { - static const OUString& lcl_getTextStreamEncodingName() - { - static const OUString s_sMapStreamEncodingName( "UTF-8" ); - return s_sMapStreamEncodingName; - } - - static const OUString& lcl_getLineFeed() - { - static const OUString s_sLineFeed( '\n' ); - return s_sLineFeed; - } - } + static const char sLineFeed[] = "\n"; // StorageTextOutputStream StorageTextOutputStream::StorageTextOutputStream( const Reference<XComponentContext>& i_rContext, @@ -74,7 +60,7 @@ namespace dbaccess ,m_pData( new StorageTextOutputStream_Data ) { m_pData->xTextOutput = TextOutputStream::create( i_rContext ); - m_pData->xTextOutput->setEncoding( lcl_getTextStreamEncodingName() ); + m_pData->xTextOutput->setEncoding( "UTF-8" ); m_pData->xTextOutput->setOutputStream( getOutputStream() ); } @@ -85,12 +71,12 @@ namespace dbaccess void StorageTextOutputStream::writeLine( const OUString& i_rLine ) { m_pData->xTextOutput->writeString( i_rLine ); - m_pData->xTextOutput->writeString( lcl_getLineFeed() ); + m_pData->xTextOutput->writeString( sLineFeed ); } void StorageTextOutputStream::writeLine() { - m_pData->xTextOutput->writeString( lcl_getLineFeed() ); + m_pData->xTextOutput->writeString( sLineFeed ); } } // namespace dbaccess diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.cxx b/dbaccess/source/core/recovery/subcomponentrecovery.cxx index f50d1754b7a0..7ebb09ab5c4b 100644 --- a/dbaccess/source/core/recovery/subcomponentrecovery.cxx +++ b/dbaccess/source/core/recovery/subcomponentrecovery.cxx @@ -81,30 +81,24 @@ namespace dbaccess // helper namespace { - static const OUString& lcl_getComponentStorageBaseName( const SubComponentType i_eType ) + static OUString lcl_getComponentStorageBaseName( const SubComponentType i_eType ) { - static const OUString s_sFormBaseName( "form" ); - static const OUString s_sReportBaseName( "report" ); - static const OUString s_sTableBaseName( "table" ); - static const OUString s_sQueryBaseName( "query" ); - switch ( i_eType ) { case FORM: - return s_sFormBaseName; + return OUString("form"); case REPORT: - return s_sReportBaseName; + return OUString("report"); case TABLE: - return s_sTableBaseName; + return OUString("table"); case QUERY: - return s_sQueryBaseName; + return OUString("query"); default: break; } OSL_FAIL( "lcl_getComponentStorageBaseName: unimplemented case!" ); - static const OUString s_sFallback; - return s_sFallback; + return OUString(); } static SubComponentType lcl_databaseObjectToSubComponentType( const sal_Int32 i_nObjectType ) @@ -166,17 +160,8 @@ namespace dbaccess return xCommandProcessor; } - static const OUString& lcl_getSettingsStreamName() - { - static const OUString s_sStatementStreamName( "settings.xml" ); - return s_sStatementStreamName; - } - - static const OUString& lcl_getCurrentQueryDesignName() - { - static const OUString s_sQuerySettingsName( "ooo:current-query-design" ); - return s_sQuerySettingsName; - } + static const char sSettingsStreamName[] = "settings.xml"; + static const char sCurrentQueryDesignName[] = "ooo:current-query-design"; } // SettingsExportContext @@ -362,31 +347,24 @@ namespace dbaccess // SubComponentRecovery const OUString SubComponentRecovery::getComponentsStorageName( const SubComponentType i_eType ) { - static const OUString s_sFormsStorageName( "forms" ); - static const OUString s_sReportsStorageName( "reports" ); - static const OUString s_sTablesStorageName( "tables" ); - static const OUString s_sQueriesStorageName( "queries" ); - static const OUString s_sRelationsStorageName( "relations" ); - switch ( i_eType ) { case FORM: - return s_sFormsStorageName; + return OUString("forms"); case REPORT: - return s_sReportsStorageName; + return OUString("reports"); case TABLE: - return s_sTablesStorageName; + return OUString("tables"); case QUERY: - return s_sQueriesStorageName; + return OUString("queries"); case RELATION_DESIGN: - return s_sRelationsStorageName; + return OUString("relations"); default: break; } OSL_FAIL( "SubComponentRecovery::getComponentsStorageName: unimplemented case!" ); - static const OUString s_sFallback; - return s_sFallback; + return OUString(); } void SubComponentRecovery::saveToRecoveryStorage( const Reference< XStorage >& i_rRecoveryStorage, @@ -498,7 +476,7 @@ namespace dbaccess OSL_VERIFY( xDesignerProps->getPropertyValue( "CurrentQueryDesign" ) >>= aCurrentQueryDesign ); // write the query design - StorageXMLOutputStream aDesignOutput( m_rContext, i_rObjectStorage, lcl_getSettingsStreamName() ); + StorageXMLOutputStream aDesignOutput( m_rContext, i_rObjectStorage, sSettingsStreamName ); SettingsExportContext aSettingsExportContext( m_rContext, aDesignOutput ); const OUString sWhitespace( " " ); @@ -507,7 +485,7 @@ namespace dbaccess aDesignOutput.ignorableWhitespace( sWhitespace ); XMLSettingsExportHelper aSettingsExporter( aSettingsExportContext ); - aSettingsExporter.exportAllSettings( aCurrentQueryDesign, lcl_getCurrentQueryDesignName() ); + aSettingsExporter.exportAllSettings( aCurrentQueryDesign, sCurrentQueryDesignName ); aDesignOutput.ignorableWhitespace( sWhitespace ); aDesignOutput.endElement(); @@ -579,13 +557,13 @@ namespace dbaccess Reference< XComponent > xSubComponent; // first read the settings query design settings from the storage - StorageXMLInputStream aDesignInput( m_rContext, i_rRecoveryStorage, lcl_getSettingsStreamName() ); + StorageXMLInputStream aDesignInput( m_rContext, i_rRecoveryStorage, sSettingsStreamName ); ::rtl::Reference< SettingsDocumentHandler > pDocHandler( new SettingsDocumentHandler ); aDesignInput.import( pDocHandler.get() ); const ::comphelper::NamedValueCollection& rSettings( pDocHandler->getSettings() ); - const Any aCurrentQueryDesign = rSettings.get( lcl_getCurrentQueryDesignName() ); + const Any aCurrentQueryDesign = rSettings.get( sCurrentQueryDesignName ); #if OSL_DEBUG_LEVEL > 0 Sequence< PropertyValue > aQueryDesignLayout; OSL_VERIFY( aCurrentQueryDesign >>= aQueryDesignLayout ); diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx index 5dea02bb9f7b..91d17b2adfd4 100644 --- a/dbaccess/source/ext/macromigration/migrationengine.cxx +++ b/dbaccess/source/ext/macromigration/migrationengine.cxx @@ -168,32 +168,22 @@ namespace dbmm namespace { - static const OUString& lcl_getScriptsStorageName() - { - static const OUString s_sScriptsStorageName( "Scripts" ); - return s_sScriptsStorageName; - } + static const char sScriptsStorageName[] = "Scripts"; - static const OUString& lcl_getScriptsSubStorageName( const ScriptType _eType ) + static OUString lcl_getScriptsSubStorageName( const ScriptType _eType ) { - static const OUString s_sBeanShell ( "beanshell" ); - static const OUString s_sJavaScript( "javascript" ); - static const OUString s_sPython ( "python" ); // TODO: is this correct? - static const OUString s_sJava ( "java" ); - switch ( _eType ) { - case eBeanShell: return s_sBeanShell; - case eJavaScript: return s_sJavaScript; - case ePython: return s_sPython; - case eJava: return s_sJava; + case eBeanShell: return OUString("beanshell"); + case eJavaScript: return OUString("javascript"); + case ePython: return OUString("python"); // TODO: is this correct? + case eJava: return OUString("java"); default: break; } OSL_FAIL( "lcl_getScriptsSubStorageName: illegal type!" ); - static OUString s_sEmpty; - return s_sEmpty; + return OUString(); } static bool lcl_getScriptTypeFromLanguage( const OUString& _rLanguage, ScriptType& _out_rScriptType ) @@ -650,15 +640,15 @@ namespace dbmm // the "Scripts" storage exist, or if it does not (yet) exist and we are in write mode // => open the storage - if ( ( xDocStorage->hasByName( lcl_getScriptsStorageName() ) - && xDocStorage->isStorageElement( lcl_getScriptsStorageName() ) + if ( ( xDocStorage->hasByName( sScriptsStorageName ) + && xDocStorage->isStorageElement( sScriptsStorageName ) ) - || !xDocStorage->hasByName( lcl_getScriptsStorageName() ) + || !xDocStorage->hasByName( sScriptsStorageName ) ) { m_xScriptsStorage.set( xDocStorage->openStorageElement( - lcl_getScriptsStorageName(), ElementModes::READWRITE + sScriptsStorageName, ElementModes::READWRITE ), UNO_QUERY_THROW ); @@ -725,7 +715,7 @@ namespace dbmm { Reference< XStorageBasedDocument > xStorageDoc( _rxDocument, UNO_QUERY_THROW ); Reference< XStorage > xDocStorage( xStorageDoc->getDocumentStorage(), UNO_QUERY_THROW ); - xDocStorage->removeElement( lcl_getScriptsStorageName() ); + xDocStorage->removeElement( sScriptsStorageName ); } catch( const Exception& ) { diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index da522f6b1d6f..c6bc6e947c81 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -138,35 +138,29 @@ namespace dbaxml { // possible types we can write (either because we recognize them directly or because we convert _rValue // into one of these types) - static const OUString s_sTypeBoolean ("boolean"); - static const OUString s_sTypeShort ("short"); - static const OUString s_sTypeInteger ("int"); - static const OUString s_sTypeLong ("long"); - static const OUString s_sTypeDouble ("double"); - static const OUString s_sTypeString ("string"); // handle the type description switch (_rType.getTypeClass()) { case TypeClass_STRING: - return s_sTypeString; + return OUString("string"); case TypeClass_DOUBLE: - return s_sTypeDouble; + return OUString("double"); case TypeClass_BOOLEAN: - return s_sTypeBoolean; + return OUString("boolean"); case TypeClass_BYTE: case TypeClass_SHORT: - return s_sTypeShort; + return OUString("short"); case TypeClass_LONG: - return s_sTypeInteger; + return OUString("int"); case TypeClass_HYPER: - return s_sTypeLong; + return OUString("long"); case TypeClass_ENUM: - return s_sTypeInteger; + return OUString("int"); default: OSL_FAIL( "lcl_implGetPropertyXMLType: unsupported value type!" ); - return s_sTypeDouble; + return OUString("double"); } } diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 538ee5757436..90d29b51778c 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -725,7 +725,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = xEnumAccess.is(); if ( aReturn.bEnabled ) { - static OUString s_sReportDesign("org.libreoffice.report.pentaho.SOReportJobFactory"); + static const char s_sReportDesign[] = "org.libreoffice.report.pentaho.SOReportJobFactory"; Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(s_sReportDesign); aReturn.bEnabled = xEnumDrivers.is() && xEnumDrivers->hasMoreElements(); } diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 06f060ee0d5c..45185eda5691 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -662,7 +662,7 @@ void OApplicationController::onLoadedMenu(const Reference< ::com::sun::star::fra if ( _xLayoutManager.is() ) { - static OUString s_sStatusbar("private:resource/statusbar/statusbar"); + static const char s_sStatusbar[] = "private:resource/statusbar/statusbar"; _xLayoutManager->createElement( s_sStatusbar ); _xLayoutManager->requestElement( s_sStatusbar ); diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 9d67df969ea1..1788fc78e683 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -2031,7 +2031,7 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property if ( xCols.is() && xCols->hasByName(sName) ) { Reference<XPropertySet> xProp(xCols->getByName(sName),UNO_QUERY); - static OUString sAgg("AggregateFunction"); + static const char sAgg[] = "AggregateFunction"; if ( xProp->getPropertySetInfo()->hasPropertyByName(sAgg) ) xProp->getPropertyValue(sAgg) >>= bHaving; } diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index afbdc240b37a..bc68c796c872 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -82,12 +82,6 @@ using namespace ::comphelper; typedef ::boost::unordered_map< sal_Int16, sal_Int16 > CommandHashMap; typedef ::std::list< DispatchInformation > DispatchInfoList; -const OUString& getConfirmDeletionURL() -{ - static const OUString sConfirmDeletionURL( ".uno:FormSlots/ConfirmDeletion" ); - return sConfirmDeletionURL; -} - namespace dbaui { @@ -659,7 +653,7 @@ Reference< XDispatch > OGenericUnoController::queryDispatch(const URL& aURL, co fillSupportedFeatures(); // URL's we can handle ourself? - if ( aURL.Complete.equals( getConfirmDeletionURL() ) + if ( aURL.Complete == ".uno:FormSlots/ConfirmDeletion" || ( ( m_aSupportedFeatures.find( aURL.Complete ) != m_aSupportedFeatures.end() ) && !isUserDefinedFeature( aURL.Complete ) ) diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index 351a070ddbf2..ab59911c4038 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -1183,7 +1183,7 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr ) ActivateAggregate( tpScale ); pScale->SetMax(::std::max<sal_Int32>(pFieldType->nMaximumScale,pFieldDescr->GetScale())); pScale->SetMin(pFieldType->nMinimumScale); - static const OUString s_sPRECISION("PRECISION"); + static const char s_sPRECISION[] = "PRECISION"; pScale->SetSpecialReadOnly(pFieldType->aCreateParams.isEmpty() || pFieldType->aCreateParams == s_sPRECISION); } else diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx index 0a54a5a92a13..f437d31d9f58 100644 --- a/dbaccess/source/ui/dlg/CollectionView.cxx +++ b/dbaccess/source/ui/dlg/CollectionView.cxx @@ -267,14 +267,14 @@ void OCollectionView::initCurrentPath() if ( m_xContent.is() ) { const OUString sCID = m_xContent->getIdentifier()->getContentIdentifier(); - const static OUString s_sFormsCID("private:forms"); - const static OUString s_sReportsCID("private:reports"); - m_bCreateForm = s_sFormsCID == sCID ; + static const char s_sFormsCID[] = "private:forms"; + static const char s_sReportsCID[] = "private:reports"; + m_bCreateForm = s_sFormsCID == sCID; OUString sPath("/"); - if ( m_bCreateForm && sCID.getLength() != s_sFormsCID.getLength()) - sPath = sCID.copy(s_sFormsCID.getLength()); - else if ( !m_bCreateForm && sCID.getLength() != s_sReportsCID.getLength() ) - sPath = sCID.copy(s_sReportsCID.getLength() - 2); + if ( m_bCreateForm && sCID.getLength() != (sal_Int32)strlen(s_sFormsCID)) + sPath = sCID.copy(strlen(s_sFormsCID)); + else if ( !m_bCreateForm && sCID.getLength() != (sal_Int32)strlen(s_sReportsCID) ) + sPath = sCID.copy(strlen(s_sReportsCID) - 2); m_pFTCurrentPath->SetText(sPath); Reference<XChild> xChild(m_xContent,UNO_QUERY); diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx index c686ae53f19b..f8ad536b0f3c 100644 --- a/dbaccess/source/ui/dlg/queryfilter.cxx +++ b/dbaccess/source/ui/dlg/queryfilter.cxx @@ -318,10 +318,10 @@ bool DlgFilterCrit::getCondition(const ListBox& _rField,const ListBox& _rComp,co } } xColumn->getPropertyValue(PROPERTY_REALNAME) >>= _rFilter.Name; - static OUString sAgg("AggregateFunction"); + static const char sAgg[] = "AggregateFunction"; if ( xInfo->hasPropertyByName(sAgg) ) xColumn->getPropertyValue(sAgg) >>= bHaving; - static OUString sFunction("Function"); + static const char sFunction[] = "Function"; if ( xInfo->hasPropertyByName(sFunction) ) xColumn->getPropertyValue(sFunction) >>= bFunction; } @@ -331,7 +331,7 @@ bool DlgFilterCrit::getCondition(const ListBox& _rField,const ListBox& _rComp,co _rFilter.Name = ::dbtools::quoteName(aQuote,_rFilter.Name); if ( !sTableName.isEmpty() ) { - static OUString sSep("."); + static const char sSep[] = "."; sTableName += sSep; sTableName += _rFilter.Name; _rFilter.Name = sTableName; diff --git a/dbaccess/source/ui/dlg/queryorder.cxx b/dbaccess/source/ui/dlg/queryorder.cxx index 69f5fe4ae4e3..f58d3ad7f0c5 100644 --- a/dbaccess/source/ui/dlg/queryorder.cxx +++ b/dbaccess/source/ui/dlg/queryorder.cxx @@ -205,8 +205,8 @@ OUString DlgOrderCrit::GetOrderList( ) const { Reference<XDatabaseMetaData> xMetaData = m_xConnection->getMetaData(); OUString sQuote = xMetaData.is() ? xMetaData->getIdentifierQuoteString() : OUString(); - static const OUString sDESC(" DESC "); - static const OUString sASC(" ASC "); + static const char sDESC[] = " DESC "; + static const char sASC[] = " ASC "; Reference< XNameAccess> xColumns = Reference< XColumnsSupplier >(m_xQueryComposer,UNO_QUERY)->getColumns(); diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx index 35e1ee977db2..9b8104c505ce 100644 --- a/dbaccess/source/ui/dlg/tablespage.cxx +++ b/dbaccess/source/ui/dlg/tablespage.cxx @@ -442,8 +442,8 @@ namespace dbaui Sequence< OUString > OTableSubscriptionPage::collectDetailedSelection() const { Sequence< OUString > aTableFilter; - static const OUString sDot("."); - static const OUString sWildcard("%"); + static const char sDot[] = "."; + static const char sWildcard[] = "%"; OUString sComposedName; const SvTreeListEntry* pAllObjectsEntry = m_pTablesList->getAllObjectsEntry(); diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 392dd7a6b4f4..c192947b4880 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -437,8 +437,8 @@ void fillTypeInfo( const Reference< ::com::sun::star::sdbc::XConnection>& _rxCo // Information for a single SQL type if(xRs.is()) { - static const OUString aB1(" [ "); - static const OUString aB2(" ]"); + static const char aB1[] = " [ "; + static const char aB2[] = " ]"; Reference<XResultSetMetaData> xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(xRs,UNO_QUERY)->getMetaData(); ::connectivity::ORowSetValue aValue; ::std::vector<sal_Int32> aTypes; diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx index 02d1759dceda..335ff098515c 100644 --- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx +++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx @@ -97,8 +97,7 @@ namespace dbaui } OUString SAL_CALL OConnectionLineAccess::getAccessibleDescription( ) throw (RuntimeException, std::exception) { - static OUString sDescription("Relation"); - return sDescription; + return OUString("Relation"); } Reference< XAccessibleRelationSet > SAL_CALL OConnectionLineAccess::getAccessibleRelationSet( ) throw (RuntimeException, std::exception) { diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 4914156429f6..5bb7a8d7c443 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -71,8 +71,8 @@ using namespace ::com::sun::star::container; // please look at the book LargeScale C++ to know why namespace { - static const OUString C_AND(" AND "); - static const OUString C_OR(" OR "); + static const char C_AND[] = " AND "; + static const char C_OR[] = " OR "; // forward declarations bool InsertJoin( const OQueryDesignView* _pView, @@ -108,8 +108,7 @@ namespace if ( _bQuote && !_sAliasName.isEmpty() ) { sRet = ::dbtools::quoteName(_sQuote,_sAliasName); - const static OUString sTableSeparater('.'); - sRet += sTableSeparater; + sRet += "."; } return sRet; } @@ -639,8 +638,8 @@ namespace OJoinTableView::OTableWindowMap& rTabList = _pView->getTableView()->GetTabWinMap(); - const static OUString sFieldSeparator(", "); - const static OUString s_sAs(" AS "); + static const char sFieldSeparator[] = ", "; + static const char s_sAs[] = " AS "; aIter = _rFieldList.begin(); for(;aIter != aEnd;++aIter) diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 1149d5fe6768..3d78dee5f153 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -259,8 +259,8 @@ namespace if ( xLayoutManager.is() ) { xLayoutManager->lock(); - static OUString s_sDesignToolbar("private:resource/toolbar/designobjectbar"); - static OUString s_sSqlToolbar("private:resource/toolbar/sqlobjectbar"); + static const char s_sDesignToolbar[] = "private:resource/toolbar/designobjectbar"; + static const char s_sSqlToolbar[] = "private:resource/toolbar/sqlobjectbar"; if ( _bDesign ) { xLayoutManager->destroyElement( s_sSqlToolbar ); @@ -283,7 +283,7 @@ namespace */ void grabFocusFromLimitBox( OQueryController& _rController ) { - static const OUString sResourceURL( "private:resource/toolbar/designobjectbar" ); + static const char sResourceURL[] = "private:resource/toolbar/designobjectbar"; Reference< XLayoutManager > xLayoutManager = _rController.getLayoutManager( _rController.getFrame() ); Reference< XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL); if (xUIElement.is()) |