diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-02 18:55:59 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-02 19:49:04 +0100 |
commit | c9b100df77331ebe1f5e66b9dd248c8cc43a885f (patch) | |
tree | 5e22351a94f4ecfc468438ea28349ca9ec9c330f /dbaccess | |
parent | b0e574a8be2a080f5039e968f4f32ce4b8fa2b26 (diff) |
Drop char*-based API from NamedValueCollection
Change-Id: I87f339b348580e256a8d65470ad15cbdabf2c9dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124609
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/dataaccess/documentdefinition.cxx | 14 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/dbloader2.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppController.cxx | 12 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppDetailPageHelper.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/databaseobjectview.cxx | 26 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/dsmeta.cxx | 62 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/linkeddocuments.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/querycontroller.cxx | 6 |
8 files changed, 61 insertions, 71 deletions
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 9a2944bb338d..7e6efc688a1e 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1441,16 +1441,14 @@ void ODocumentDefinition::separateOpenCommandArguments( const Sequence< Property { ::comphelper::NamedValueCollection aOpenCommandArguments( i_rOpenCommandArguments ); - const char* const pObjectDescriptorArgs[] = + static const std::u16string_view sObjectDescriptorArgs[] = { u"RecoveryStorage" }; + for (const auto& rObjectDescriptorArg : sObjectDescriptorArgs) { - "RecoveryStorage" - }; - for (const char* pObjectDescriptorArg : pObjectDescriptorArgs) - { - if ( aOpenCommandArguments.has( pObjectDescriptorArg ) ) + const OUString sObjectDescriptorArg(rObjectDescriptorArg); + if ( aOpenCommandArguments.has( sObjectDescriptorArg ) ) { - o_rEmbeddedObjectDescriptor.put( pObjectDescriptorArg, aOpenCommandArguments.get( pObjectDescriptorArg ) ); - aOpenCommandArguments.remove( pObjectDescriptorArg ); + o_rEmbeddedObjectDescriptor.put( sObjectDescriptorArg, aOpenCommandArguments.get( sObjectDescriptorArg ) ); + aOpenCommandArguments.remove( sObjectDescriptorArg ); } } diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx index 0f0674d2c038..30d613a56e4b 100644 --- a/dbaccess/source/filter/xml/dbloader2.cxx +++ b/dbaccess/source/filter/xml/dbloader2.cxx @@ -138,8 +138,8 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope { // After fixing of the i88522 issue ( use the new file locking for database files ) the stream from the type detection can be used further // for now the file should be reopened to have read/write access - aMedia.remove( OUString( "InputStream" ) ); - aMedia.remove( OUString( "Stream" ) ); + aMedia.remove( "InputStream" ); + aMedia.remove( "Stream" ); aMedia >>= Descriptor; try { @@ -374,7 +374,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU else { ::comphelper::NamedValueCollection aCreationArgs; - aCreationArgs.put( OUString(INFO_POOLURL), sSalvagedURL ); + aCreationArgs.put( INFO_POOLURL, sSalvagedURL ); xDocumentDataSource.set( xDatabaseContext->createInstanceWithArguments( aCreationArgs.getWrappedNamedValues() ), UNO_QUERY_THROW ); } diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 7a329bc513f0..ed36971392b9 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1170,7 +1170,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa eType = E_QUERY; break; case ID_NEW_QUERY_DESIGN: - aCreationArgs.put( OUString(PROPERTY_GRAPHICAL_DESIGN), true ); + aCreationArgs.put( PROPERTY_GRAPHICAL_DESIGN, true ); [[fallthrough]]; case ID_NEW_QUERY_SQL: eType = E_QUERY; @@ -1208,7 +1208,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa QueryDesigner aDesigner( getORB(), this, getFrame(), true ); ::comphelper::NamedValueCollection aCreationArgs; - aCreationArgs.put( OUString(PROPERTY_GRAPHICAL_DESIGN), ID_NEW_VIEW_DESIGN == _nId ); + aCreationArgs.put( PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId ); const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); const Reference< XComponent > xComponent = aDesigner.createNew( xDataSource, aCreationArgs ); @@ -1821,7 +1821,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const if ( bAddViewTypeArg ) { const bool bQueryGraphicalMode =( _nInstigatorCommand != SID_DB_APP_EDIT_SQL_VIEW ); - aArguments.put( OUString(PROPERTY_GRAPHICAL_DESIGN), bQueryGraphicalMode ); + aArguments.put( PROPERTY_GRAPHICAL_DESIGN, bQueryGraphicalMode ); } } @@ -1829,8 +1829,8 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const { pDesigner.reset( new ResultSetBrowser( getORB(), this, m_aCurrentFrame.getFrame(), _eType == E_TABLE ) ); - if ( !aArguments.has( OUString(PROPERTY_SHOWMENU) ) ) - aArguments.put( OUString(PROPERTY_SHOWMENU), makeAny( true ) ); + if ( !aArguments.has( PROPERTY_SHOWMENU ) ) + aArguments.put( PROPERTY_SHOWMENU, makeAny( true ) ); aDataSource <<= getDatabaseName(); } @@ -2622,7 +2622,7 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > { // to get the 'modified' for the data source ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) ); - if ( aLayoutInfo.has( OUString(INFO_PREVIEW) ) ) + if ( aLayoutInfo.has( INFO_PREVIEW ) ) { const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, sal_Int32(0) ) ); m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode ); diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 18767cc46a51..e4b2b86f62bd 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -1043,7 +1043,7 @@ void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName, aArgs.put( "Preview", true ); aArgs.put( "ReadOnly", true ); aArgs.put( "AsTemplate", false ); - aArgs.put( OUString(PROPERTY_SHOWMENU), false ); + aArgs.put( PROPERTY_SHOWMENU, false ); Reference< XController > xPreview( pDispatcher->openExisting( makeAny( _sDataSourceName ), _sName, aArgs ), UNO_QUERY ); bool bClearPreview = !xPreview.is(); diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx index 4a58f085acb0..e59622276433 100644 --- a/dbaccess/source/ui/misc/databaseobjectview.cxx +++ b/dbaccess/source/ui/misc/databaseobjectview.cxx @@ -146,14 +146,14 @@ namespace dbaui Reference<XDataSource> xDataSource; if ( _aDataSource >>= sDataSource ) { - i_rDispatchArgs.put( OUString(PROPERTY_DATASOURCENAME), sDataSource ); + i_rDispatchArgs.put( PROPERTY_DATASOURCENAME, sDataSource ); } else if ( _aDataSource >>= xDataSource ) { - i_rDispatchArgs.put( OUString(PROPERTY_DATASOURCE), xDataSource ); + i_rDispatchArgs.put( PROPERTY_DATASOURCE, xDataSource ); } - i_rDispatchArgs.put( OUString(PROPERTY_ACTIVE_CONNECTION), getConnection() ); + i_rDispatchArgs.put( PROPERTY_ACTIVE_CONNECTION, getConnection() ); } // QueryDesigner @@ -173,16 +173,16 @@ namespace dbaui const bool bGraphicalDesign = i_rDispatchArgs.getOrDefault( PROPERTY_GRAPHICAL_DESIGN, true ); const bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && !bGraphicalDesign; - i_rDispatchArgs.put( OUString(PROPERTY_COMMAND_TYPE), m_nCommandType ); + i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, m_nCommandType ); if ( bIncludeQueryName ) { - i_rDispatchArgs.put( OUString(PROPERTY_COMMAND), _rObjectName ); + i_rDispatchArgs.put( PROPERTY_COMMAND, _rObjectName ); } if ( bEditViewAsSQLCommand ) { - i_rDispatchArgs.put( OUString(PROPERTY_ESCAPE_PROCESSING), false ); + i_rDispatchArgs.put( PROPERTY_ESCAPE_PROCESSING, false ); } } @@ -199,7 +199,7 @@ namespace dbaui if ( !_rObjectName.isEmpty() ) { - i_rDispatchArgs.put( OUString(PROPERTY_CURRENTTABLE), _rObjectName ); + i_rDispatchArgs.put( PROPERTY_CURRENTTABLE, _rObjectName ); } } @@ -258,15 +258,15 @@ namespace dbaui if ( m_bTable ) ::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::EComposeRule::InDataManipulation ); - i_rDispatchArgs.put( OUString(PROPERTY_COMMAND_TYPE), (m_bTable ? CommandType::TABLE : CommandType::QUERY) ); - i_rDispatchArgs.put( OUString(PROPERTY_COMMAND), _rQualifiedName ); - i_rDispatchArgs.put( OUString(PROPERTY_ENABLE_BROWSER), false ); + i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, (m_bTable ? CommandType::TABLE : CommandType::QUERY) ); + i_rDispatchArgs.put( PROPERTY_COMMAND, _rQualifiedName ); + i_rDispatchArgs.put( PROPERTY_ENABLE_BROWSER, false ); if ( m_bTable ) { - i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_CATALOGNAME), sCatalog ); - i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_SCHEMANAME), sSchema ); - i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_TABLENAME), sTable ); + i_rDispatchArgs.put( PROPERTY_UPDATE_CATALOGNAME, sCatalog ); + i_rDispatchArgs.put( PROPERTY_UPDATE_SCHEMANAME, sSchema ); + i_rDispatchArgs.put( PROPERTY_UPDATE_TABLENAME, sTable ); } } diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx index f84c580ed4c4..286ce63aace2 100644 --- a/dbaccess/source/ui/misc/dsmeta.cxx +++ b/dbaccess/source/ui/misc/dsmeta.cxx @@ -53,39 +53,33 @@ namespace dbaui { /// one of the items from dsitems.hxx ItemID nItemID; - const char* pAsciiFeatureName; + OUString pAsciiFeatureName; }; - } - // global tables - static const FeatureMapping* lcl_getFeatureMappings() - { - static const FeatureMapping s_aMappings[] = { - { DSID_AUTORETRIEVEENABLED, "GeneratedValues" }, - { DSID_AUTOINCREMENTVALUE, "GeneratedValues" }, - { DSID_AUTORETRIEVEVALUE, "GeneratedValues" }, - { DSID_SQL92CHECK, "UseSQL92NamingConstraints" }, - { DSID_APPEND_TABLE_ALIAS, "AppendTableAliasInSelect" }, - { DSID_AS_BEFORE_CORRNAME, "UseKeywordAsBeforeAlias" }, - { DSID_ENABLEOUTERJOIN, "UseBracketedOuterJoinSyntax" }, - { DSID_IGNOREDRIVER_PRIV, "IgnoreDriverPrivileges" }, - { DSID_PARAMETERNAMESUBST, "ParameterNameSubstitution" }, - { DSID_SUPPRESSVERSIONCL, "DisplayVersionColumns" }, - { DSID_CATALOG, "UseCatalogInSelect" }, - { DSID_SCHEMA, "UseSchemaInSelect" }, - { DSID_INDEXAPPENDIX, "UseIndexDirectionKeyword" }, - { DSID_DOSLINEENDS, "UseDOSLineEnds" }, - { DSID_BOOLEANCOMPARISON, "BooleanComparisonMode" }, - { DSID_CHECK_REQUIRED_FIELDS, "FormsCheckRequiredFields" }, - { DSID_IGNORECURRENCY, "IgnoreCurrency" }, - { DSID_ESCAPE_DATETIME, "EscapeDateTime" }, - { DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" }, - { DSID_RESPECTRESULTSETTYPE, "RespectDriverResultSetType" }, - { DSID_MAX_ROW_SCAN, "MaxRowScan" }, - { 0, nullptr } - }; - return s_aMappings; + const FeatureMapping s_aMappings[] = { + { DSID_AUTORETRIEVEENABLED, "GeneratedValues" }, + { DSID_AUTOINCREMENTVALUE, "GeneratedValues" }, + { DSID_AUTORETRIEVEVALUE, "GeneratedValues" }, + { DSID_SQL92CHECK, "UseSQL92NamingConstraints" }, + { DSID_APPEND_TABLE_ALIAS, "AppendTableAliasInSelect" }, + { DSID_AS_BEFORE_CORRNAME, "UseKeywordAsBeforeAlias" }, + { DSID_ENABLEOUTERJOIN, "UseBracketedOuterJoinSyntax" }, + { DSID_IGNOREDRIVER_PRIV, "IgnoreDriverPrivileges" }, + { DSID_PARAMETERNAMESUBST, "ParameterNameSubstitution" }, + { DSID_SUPPRESSVERSIONCL, "DisplayVersionColumns" }, + { DSID_CATALOG, "UseCatalogInSelect" }, + { DSID_SCHEMA, "UseSchemaInSelect" }, + { DSID_INDEXAPPENDIX, "UseIndexDirectionKeyword" }, + { DSID_DOSLINEENDS, "UseDOSLineEnds" }, + { DSID_BOOLEANCOMPARISON, "BooleanComparisonMode" }, + { DSID_CHECK_REQUIRED_FIELDS, "FormsCheckRequiredFields" }, + { DSID_IGNORECURRENCY, "IgnoreCurrency" }, + { DSID_ESCAPE_DATETIME, "EscapeDateTime" }, + { DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" }, + { DSID_RESPECTRESULTSETTYPE, "RespectDriverResultSetType" }, + { DSID_MAX_ROW_SCAN, "MaxRowScan" }, + }; } static const FeatureSet& lcl_getFeatureSet( const OUString& _rURL ) @@ -101,12 +95,10 @@ namespace dbaui FeatureSet aCurrentSet; const ::comphelper::NamedValueCollection aCurrentFeatures( aDriverConfig.getFeatures( pattern ).getNamedValues() ); - const FeatureMapping* pFeatureMapping = lcl_getFeatureMappings(); - while ( pFeatureMapping->pAsciiFeatureName ) + for ( const FeatureMapping& rFeatureMapping : s_aMappings ) { - if ( aCurrentFeatures.has( pFeatureMapping->pAsciiFeatureName ) ) - aCurrentSet.put( pFeatureMapping->nItemID ); - ++pFeatureMapping; + if ( aCurrentFeatures.has( rFeatureMapping.pAsciiFeatureName ) ) + aCurrentSet.put( rFeatureMapping.nItemID ); } tmp[ pattern ] = aCurrentSet; diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index 15394133ed59..192331ced226 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -135,7 +135,7 @@ namespace dbaui } aArguments.put( "OpenMode", sOpenMode ); - aArguments.put( OUString(PROPERTY_ACTIVE_CONNECTION), m_xConnection ); + aArguments.put( PROPERTY_ACTIVE_CONNECTION, m_xConnection ); Reference<XHierarchicalNameContainer> xHier(m_xDocumentContainer,UNO_QUERY); if ( xHier.is() && xHier->hasByHierarchicalName(_rLinkName) ) @@ -251,7 +251,7 @@ namespace dbaui ::comphelper::NamedValueCollection aCreationArgs( i_rCreationArgs ); if ( aClassId.hasElements() ) aCreationArgs.put( "ClassID", aClassId ); - aCreationArgs.put( OUString(PROPERTY_ACTIVE_CONNECTION), m_xConnection ); + aCreationArgs.put( PROPERTY_ACTIVE_CONNECTION, m_xConnection ); // separate values which are real creation args from args relevant for opening the doc ::comphelper::NamedValueCollection aCommandArgs; diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 450a1ba416a8..360cd2821235 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -245,7 +245,7 @@ void SAL_CALL OQueryController::getFastPropertyValue( Any& o_rValue, sal_Int32 i { ::comphelper::NamedValueCollection aCurrentDesign; aCurrentDesign.put( "GraphicalDesign", isGraphicalDesign() ); - aCurrentDesign.put( OUString(PROPERTY_ESCAPE_PROCESSING), m_bEscapeProcessing ); + aCurrentDesign.put( PROPERTY_ESCAPE_PROCESSING, m_bEscapeProcessing ); if ( isGraphicalDesign() ) { @@ -735,11 +735,11 @@ void OQueryController::impl_initialize() if ( aCurrentQueryDesignProps.hasElements() ) { ::comphelper::NamedValueCollection aCurrentQueryDesign( aCurrentQueryDesignProps ); - if ( aCurrentQueryDesign.has( OUString(PROPERTY_GRAPHICAL_DESIGN) ) ) + if ( aCurrentQueryDesign.has( PROPERTY_GRAPHICAL_DESIGN ) ) { aCurrentQueryDesign.get_ensureType( PROPERTY_GRAPHICAL_DESIGN, m_bGraphicalDesign ); } - if ( aCurrentQueryDesign.has( OUString(PROPERTY_ESCAPE_PROCESSING) ) ) + if ( aCurrentQueryDesign.has( PROPERTY_ESCAPE_PROCESSING ) ) { aCurrentQueryDesign.get_ensureType( PROPERTY_ESCAPE_PROCESSING, m_bEscapeProcessing ); } |