From 1c3e84d8192218befebcddae2ed9842d081dc6c7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 30 Jan 2017 16:38:54 +0200 Subject: teach lolugin:stringconstant about calling constructors so we can remove unnecessary calls to the OUString(literal) constructor when calling constructors like this: Foo(OUString("xxx"), 1) Change-Id: I1de60ef561437c86b27dc9cb095a5deb2e103b36 Reviewed-on: https://gerrit.libreoffice.org/33698 Tested-by: Jenkins Reviewed-by: Noel Grandin --- dbaccess/source/filter/xml/dbloader2.cxx | 4 ++-- dbaccess/source/ui/app/AppControllerGen.cxx | 6 +++--- dbaccess/source/ui/browser/dbloader.cxx | 2 +- dbaccess/source/ui/browser/unodatbr.cxx | 10 +++++----- dbaccess/source/ui/dlg/DbAdminImpl.cxx | 12 ++++++------ dbaccess/source/ui/dlg/UserAdminDlg.cxx | 2 +- dbaccess/source/ui/dlg/admincontrols.cxx | 2 +- dbaccess/source/ui/dlg/dbadmin.cxx | 2 +- dbaccess/source/ui/dlg/generalpage.cxx | 2 +- dbaccess/source/ui/misc/RowSetDrop.cxx | 2 +- dbaccess/source/ui/misc/TableCopyHelper.cxx | 6 +++--- dbaccess/source/ui/misc/UITools.cxx | 4 ++-- dbaccess/source/ui/querydesign/limitboxcontroller.cxx | 2 +- dbaccess/source/ui/uno/textconnectionsettings_uno.cxx | 12 ++++++------ 14 files changed, 34 insertions(+), 34 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx index 4a53e8377dc0..a1010534703c 100644 --- a/dbaccess/source/filter/xml/dbloader2.cxx +++ b/dbaccess/source/filter/xml/dbloader2.cxx @@ -340,13 +340,13 @@ bool DBContentLoader::impl_executeNewDatabaseWizard( Reference< XModel >& _rxMod { Sequence< Any > aWizardArgs(2); aWizardArgs[0] <<= PropertyValue( - OUString("ParentWindow"), + "ParentWindow", 0, makeAny( lcl_getTopMostWindow( m_aContext ) ), PropertyState_DIRECT_VALUE); aWizardArgs[1] <<= PropertyValue( - OUString("InitialSelection"), + "InitialSelection", 0, makeAny( _rxModel ), PropertyState_DIRECT_VALUE); diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 027b7eb08a91..72202357a71d 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -119,7 +119,7 @@ void OApplicationController::convertToView(const OUString& _sName) ::dbtools::composeTableName( xMeta, sCatalog, sSchema, sName, false, ::dbtools::EComposeRule::InTableDefinitions ) ); Reference xView = ::dbaui::createView(sNewName,xConnection,xSourceObject); if ( !xView.is() ) - throw SQLException(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE),*this,OUString( "S1000" ) ,0,Any()); + throw SQLException(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE),*this, "S1000",0,Any()); getContainer()->elementAdded(E_TABLE,sNewName,makeAny(xView)); } } @@ -175,7 +175,7 @@ void OApplicationController::openDialog( const OUString& _sServiceName ) xWindow = VCLUnoHelper::GetInterface(getView()->Window::GetParent()); } // the parent window - aArgs[nArgPos++] <<= PropertyValue( OUString("ParentWindow"), + aArgs[nArgPos++] <<= PropertyValue( "ParentWindow", 0, makeAny(xWindow), PropertyState_DIRECT_VALUE); @@ -187,7 +187,7 @@ void OApplicationController::openDialog( const OUString& _sServiceName ) if ( !sInitialSelection.isEmpty() ) { aArgs[ nArgPos++ ] <<= PropertyValue( - OUString( "InitialSelection" ), 0, + "InitialSelection", 0, makeAny( sInitialSelection ), PropertyState_DIRECT_VALUE ); } diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx index 3f0769f462e0..7415e3a10698 100644 --- a/dbaccess/source/ui/browser/dbloader.cxx +++ b/dbaccess/source/ui/browser/dbloader.cxx @@ -254,7 +254,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU try { Reference xIni(xController,UNO_QUERY); - PropertyValue aFrame(OUString("Frame"),0,makeAny(rFrame),PropertyState_DIRECT_VALUE); + PropertyValue aFrame("Frame",0,makeAny(rFrame),PropertyState_DIRECT_VALUE); Sequence< Any > aInitArgs(m_aArgs.getLength()+1); Any* pBegin = aInitArgs.getArray(); diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index f13aee4edc59..2ab8bf61b140 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -695,13 +695,13 @@ bool SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm case DataType::BOOLEAN: { aCurrentModelType = "CheckBox"; - aInitialValues.push_back( NamedValue( OUString( "VisualEffect" ), makeAny( VisualEffect::FLAT ) ) ); + aInitialValues.push_back( NamedValue( "VisualEffect", makeAny( VisualEffect::FLAT ) ) ); sDefaultProperty = PROPERTY_DEFAULTSTATE; sal_Int32 nNullable = ColumnValue::NULLABLE_UNKNOWN; OSL_VERIFY( xColumn->getPropertyValue( PROPERTY_ISNULLABLE ) >>= nNullable ); aInitialValues.push_back( NamedValue( - OUString( "TriState" ), + "TriState", makeAny( ColumnValue::NO_NULLS != nNullable ) ) ); if ( ColumnValue::NO_NULLS == nNullable ) @@ -711,7 +711,7 @@ bool SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm case DataType::LONGVARCHAR: case DataType::CLOB: - aInitialValues.push_back( NamedValue( OUString( "MultiLine" ), makeAny( true ) ) ); + aInitialValues.push_back( NamedValue( "MultiLine", makeAny( true ) ) ); SAL_FALLTHROUGH; case DataType::BINARY: case DataType::VARBINARY: @@ -729,8 +729,8 @@ bool SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm sDefaultProperty = PROPERTY_EFFECTIVEDEFAULT; if ( xSupplier.is() ) - aInitialValues.push_back( NamedValue( OUString("FormatsSupplier"), makeAny( xSupplier ) ) ); - aInitialValues.push_back( NamedValue( OUString("TreatAsNumber"), makeAny( bFormattedIsNumeric ) ) ); + aInitialValues.push_back( NamedValue( "FormatsSupplier", makeAny( xSupplier ) ) ); + aInitialValues.push_back( NamedValue( "TreatAsNumber", makeAny( bFormattedIsNumeric ) ) ); aCopyProperties.push_back( static_cast(PROPERTY_FORMATKEY) ); break; } diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 2490f0eaf31c..357b7e23fc20 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -224,7 +224,7 @@ bool ODbDataSourceAdministrationHelper::getCurrentSettings(Sequence< PropertyVal const SfxStringItem* pUser = m_pItemSetHelper->getOutputSet()->GetItem(DSID_USER); if (pUser && pUser->GetValue().getLength()) aReturn.push_back( - PropertyValue( OUString("user"), 0, + PropertyValue( "user", 0, makeAny(OUString(pUser->GetValue())), PropertyState_DIRECT_VALUE)); // check if the connection type requires a password @@ -310,7 +310,7 @@ bool ODbDataSourceAdministrationHelper::getCurrentSettings(Sequence< PropertyVal if (!sPassword.isEmpty()) aReturn.push_back( - PropertyValue( OUString("password"), 0, + PropertyValue( "password", 0, makeAny(OUString(sPassword)), PropertyState_DIRECT_VALUE)); } @@ -396,8 +396,8 @@ Reference< XDriver > ODbDataSourceAdministrationHelper::getDriver(const OUString catch (const Exception& e) { // wrap the exception into an SQLException - SQLException aSQLWrapper(e.Message, getORB(), OUString("S1000"), 0, Any()); - throw SQLException(sCurrentActionError, getORB(), OUString("S1000"), 0, makeAny(aSQLWrapper)); + SQLException aSQLWrapper(e.Message, getORB(), "S1000", 0, Any()); + throw SQLException(sCurrentActionError, getORB(), "S1000", 0, makeAny(aSQLWrapper)); } Reference< XDriver > xDriver = xDriverManager->getDriverByURL(_sURL); @@ -406,7 +406,7 @@ Reference< XDriver > ODbDataSourceAdministrationHelper::getDriver(const OUString sCurrentActionError = ModuleRes(STR_NOREGISTEREDDRIVER); sCurrentActionError = sCurrentActionError.replaceFirst("#connurl#", _sURL); // will be caught and translated into an SQLContext exception - throw SQLException(sCurrentActionError, getORB(), OUString("S1000"), 0, Any()); + throw SQLException(sCurrentActionError, getORB(), "S1000", 0, Any()); } return xDriver; } @@ -807,7 +807,7 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS // here we have a special entry for types from oracle if ( aTypeSettings.getLength() ) { - aRelevantSettings.insert(PropertyValue(OUString("TypeInfoSettings"), 0, makeAny(aTypeSettings), PropertyState_DIRECT_VALUE)); + aRelevantSettings.insert(PropertyValue("TypeInfoSettings", 0, makeAny(aTypeSettings), PropertyState_DIRECT_VALUE)); } // check which values are still left ('cause they were not present in the original sequence, but are to be set) diff --git a/dbaccess/source/ui/dlg/UserAdminDlg.cxx b/dbaccess/source/ui/dlg/UserAdminDlg.cxx index f4224c789eb1..47d9f13bad92 100644 --- a/dbaccess/source/ui/dlg/UserAdminDlg.cxx +++ b/dbaccess/source/ui/dlg/UserAdminDlg.cxx @@ -102,7 +102,7 @@ namespace dbaui if ( !aMetaData.supportsUserAdministration( getORB() ) ) { OUString sError(ModuleRes(STR_USERADMIN_NOT_AVAILABLE)); - throw SQLException(sError,nullptr,OUString("S1000") ,0,Any()); + throw SQLException(sError,nullptr, "S1000" ,0,Any()); } } catch(const SQLException&) diff --git a/dbaccess/source/ui/dlg/admincontrols.cxx b/dbaccess/source/ui/dlg/admincontrols.cxx index 46e6e45136b0..6fa310360a1b 100644 --- a/dbaccess/source/ui/dlg/admincontrols.cxx +++ b/dbaccess/source/ui/dlg/admincontrols.cxx @@ -156,7 +156,7 @@ namespace dbaui m_aControlDependencies.enableOnRadioCheck( *m_pNamedPipeRadio, *m_pNamedPipe ); m_aControlDependencies.addController( std::shared_ptr( - new TextResetOperatorController( *m_pHostName, OUString("localhost") ) + new TextResetOperatorController( *m_pHostName, "localhost" ) ) ); // sockets are available on Unix systems only, named pipes only on Windows diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index f840c18b8dd3..8a7d4879d17b 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -435,7 +435,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp }; OSL_ENSURE(SAL_N_ELEMENTS(aItemInfos) == DSID_LAST_ITEM_ID,"Invalid Ids!"); - _rpPool = new SfxItemPool(OUString("DSAItemPool"), DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID, + _rpPool = new SfxItemPool("DSAItemPool", DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID, aItemInfos, _rpDefaults); _rpPool->FreezeIdRanges(); diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index 144e86d4b55e..cdd0bc258557 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -717,7 +717,7 @@ namespace dbaui { ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, - FileDialogFlags::NONE, OUString("sdatabase") ); + FileDialogFlags::NONE, "sdatabase" ); std::shared_ptr pFilter = getStandardDatabaseFilter(); if ( pFilter ) { diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx index b2aac31dc5db..e006693b208a 100644 --- a/dbaccess/source/ui/misc/RowSetDrop.cxx +++ b/dbaccess/source/ui/misc/RowSetDrop.cxx @@ -62,7 +62,7 @@ void ORowSetImportExport::initialize() m_xTargetResultSetMetaData = Reference(m_xTargetResultSetUpdate,UNO_QUERY)->getMetaData(); if(!m_xTargetResultSetMetaData.is() || !xColumnLocate.is() || !m_xResultSetMetaData.is() ) - throw SQLException(ModuleRes(STR_UNEXPECTED_ERROR),*this,OUString("S1000") ,0,Any()); + throw SQLException(ModuleRes(STR_UNEXPECTED_ERROR),*this,"S1000",0,Any()); sal_Int32 nCount = m_xTargetResultSetMetaData->getColumnCount(); m_aColumnMapping.reserve(nCount); diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx index d7b3864001d0..0b75d816e81d 100644 --- a/dbaccess/source/ui/misc/TableCopyHelper.cxx +++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx @@ -205,7 +205,7 @@ void OTableCopyHelper::pasteTable( SotClipboardFormatId _nFormatId aTrans.bHtml = SotClipboardFormatId::HTML == _nFormatId; aTrans.sDefaultTableName = GetTableNameForAppend(); if ( !bOk || !copyTagTable(aTrans,false,_xConnection) ) - m_pController->showError(SQLException(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, OUString("S1000"), 0, Any())); + m_pController->showError(SQLException(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, "S1000", 0, Any())); } catch(const SQLException&) { @@ -217,7 +217,7 @@ void OTableCopyHelper::pasteTable( SotClipboardFormatId _nFormatId } } else - m_pController->showError(SQLException(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, OUString("S1000"), 0, Any())); + m_pController->showError(SQLException(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, "S1000", 0, Any())); } void OTableCopyHelper::pasteTable( const TransferableDataHelper& _rTransData @@ -314,7 +314,7 @@ void OTableCopyHelper::asyncCopyTagTable( DropDescriptor& _rDesc else if ( !_rDesc.bError ) pasteTable(_rDesc.aDroppedData,i_rDestDataSource,_xConnection); else - m_pController->showError(SQLException(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, OUString("S1000"), 0, Any())); + m_pController->showError(SQLException(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, "S1000", 0, Any())); } } // namespace dbaui diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 4c95c57feb74..987a4ea4d0fc 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -818,7 +818,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent, new SvxNumberInfoItem(SID_ATTR_NUMBERFORMAT_INFO) }; - SfxItemPool* pPool = new SfxItemPool(OUString("GridBrowserProperties"), SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY, aItemInfos, &pDefaults); + SfxItemPool* pPool = new SfxItemPool("GridBrowserProperties", SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY, aItemInfos, &pDefaults); pPool->SetDefaultMetric( MapUnit::MapTwip ); // ripped, don't understand why pPool->FreezeIdRanges(); // the same @@ -1445,7 +1445,7 @@ bool insertHierachyElement( vcl::Window* _pParent, const Reference< XComponentCo { OUString sError(ModuleRes(STR_NAME_ALREADY_EXISTS)); sError = sError.replaceFirst("#",sNewName); - throw SQLException(sError,nullptr,OUString("S1000") ,0,Any()); + throw SQLException(sError,nullptr,"S1000",0,Any()); } try diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx index d0b1943ae657..dac50054acb4 100644 --- a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx +++ b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx @@ -90,7 +90,7 @@ LimitBoxController::LimitBoxController( const uno::Reference< uno::XComponentContext >& rxContext ) : svt::ToolboxController( rxContext, uno::Reference< frame::XFrame >(), - OUString( ".uno:DBLimit" ) ), + ".uno:DBLimit" ), m_pLimitBox( nullptr ) { } diff --git a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx index 7bbd6a749ee5..7f6c4a6eb5e8 100644 --- a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx +++ b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx @@ -159,42 +159,42 @@ namespace dbaui aProps.realloc( nProp + 6 ); aProps[ nProp++ ] = Property( - OUString( "HeaderLine" ), + "HeaderLine", PROPERTY_ID_HEADER_LINE, ::cppu::UnoType< sal_Bool >::get(), PropertyAttribute::TRANSIENT ); aProps[ nProp++ ] = Property( - OUString( "FieldDelimiter" ), + "FieldDelimiter", PROPERTY_ID_FIELD_DELIMITER, ::cppu::UnoType< OUString >::get(), PropertyAttribute::TRANSIENT ); aProps[ nProp++ ] = Property( - OUString( "StringDelimiter" ), + "StringDelimiter", PROPERTY_ID_STRING_DELIMITER, ::cppu::UnoType< OUString >::get(), PropertyAttribute::TRANSIENT ); aProps[ nProp++ ] = Property( - OUString( "DecimalDelimiter" ), + "DecimalDelimiter", PROPERTY_ID_DECIMAL_DELIMITER, ::cppu::UnoType< OUString >::get(), PropertyAttribute::TRANSIENT ); aProps[ nProp++ ] = Property( - OUString( "ThousandDelimiter" ), + "ThousandDelimiter", PROPERTY_ID_THOUSAND_DELIMITER, ::cppu::UnoType< OUString >::get(), PropertyAttribute::TRANSIENT ); aProps[ nProp++ ] = Property( - OUString( "CharSet" ), + "CharSet", PROPERTY_ID_ENCODING, ::cppu::UnoType< OUString >::get(), PropertyAttribute::TRANSIENT -- cgit