From ba0a57702cdef7a0389c06841711d7e3079d471c Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Sat, 29 Jun 2013 21:24:12 +0200 Subject: remove OUString wrap for string literals For some functions and all kinds of Exceptions. CannotConvertException CloseVetoException DisposedException EmptyUndoStackException ErrorCodeIOException Exception GridInvalidDataException GridInvalidModelException IOException IllegalAccessException IllegalArgumentException IllegalTypeException IndexOutOfBoundsException NoMasterException NoSuchElementException NoSupportException PropertyVetoException RuntimeException SAXException ScannerException StorageWrappedTargetException UnsupportedFlavorException VetoException WrappedTargetException ZipIOException throwGenericSQLException throwIllegallArgumentException createInstance createInstanceWithContext forName getByName getPackageManager getPropertyValue getUnpackedValueOrDefault getValueByName hasPropertyByName openKey setName setPropertyValue supportsService bash command: for i in `cat list`; do git grep "$i\s*(\s*OUString(\s*\"" -- '*.[hc]xx' | cut -d ':' -f1 | sort -u | xargs sed -i -e "s/\(\<$i\s*(\)\s*OUString(\s*\(\"[^\")\\]*\"\)\s*)\s*/\1\2/g" -e "s/\($i.*\)\"+ /\1\" + /g"; done Change-Id: Iaf8e641b0abf28c082906014f87a183517630535 Reviewed-on: https://gerrit.libreoffice.org/4624 Tested-by: LibreOffice gerrit bot Reviewed-by: Thomas Arnhold Tested-by: Thomas Arnhold --- unotools/source/config/confignode.cxx | 2 +- unotools/source/config/lingucfg.cxx | 20 ++++++++++---------- unotools/source/config/moduleoptions.cxx | 10 +++++----- unotools/source/ucbhelper/ucbhelper.cxx | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) (limited to 'unotools') diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index ac24a4bf445a..2f6550a66e2e 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -341,7 +341,7 @@ namespace utl Reference< XServiceInfo > xSI(m_xHierarchyAccess, UNO_QUERY); if (xSI.is()) { - try { bIsSet = xSI->supportsService(OUString("com.sun.star.configuration.SetAccess")); } + try { bIsSet = xSI->supportsService("com.sun.star.configuration.SetAccess"); } catch(Exception&) { } } return bIsSet; diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 484869e7de36..a48e018a2e81 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -894,7 +894,7 @@ sal_Bool SvtLinguConfig::GetElementNamesFor( try { uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName(OUString("ServiceManager")), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW ); xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW ); rElementNames = xNA->getElementNames(); bSuccess = true; @@ -916,7 +916,7 @@ sal_Bool SvtLinguConfig::GetSupportedDictionaryFormatsFor( try { uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName(OUString("ServiceManager")), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW ); xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW ); xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW ); if (xNA->getByName( OUString(aG_SupportedDictionaryFormats) ) >>= rFormatList) @@ -980,7 +980,7 @@ sal_Bool SvtLinguConfig::GetDictionaryEntry( try { uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName(OUString("ServiceManager")), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW ); xNA.set( xNA->getByName(OUString(aG_Dictionaries)), uno::UNO_QUERY_THROW ); xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW ); @@ -1027,7 +1027,7 @@ uno::Sequence< OUString > SvtLinguConfig::GetDisabledDictionaries() const try { uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName(OUString("ServiceManager")), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW ); xNA->getByName( OUString(aG_DisabledDictionaries) ) >>= aResult; } catch (uno::Exception &) @@ -1126,16 +1126,16 @@ OUString SvtLinguConfig::GetVendorImageUrl_Impl( try { uno::Reference< container::XNameAccess > xImagesNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xImagesNA.set( xImagesNA->getByName(OUString("Images")), uno::UNO_QUERY_THROW ); + xImagesNA.set( xImagesNA->getByName("Images"), uno::UNO_QUERY_THROW ); - uno::Reference< container::XNameAccess > xNA( xImagesNA->getByName(OUString("ServiceNameEntries")), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xNA( xImagesNA->getByName("ServiceNameEntries"), uno::UNO_QUERY_THROW ); xNA.set( xNA->getByName( rServiceImplName ), uno::UNO_QUERY_THROW ); - uno::Any aAny(xNA->getByName(OUString("VendorImagesNode"))); + uno::Any aAny(xNA->getByName("VendorImagesNode")); OUString aVendorImagesNode; if (aAny >>= aVendorImagesNode) { xNA = xImagesNA; - xNA.set( xNA->getByName(OUString("VendorImages")), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName("VendorImages"), uno::UNO_QUERY_THROW ); xNA.set( xNA->getByName( aVendorImagesNode ), uno::UNO_QUERY_THROW ); aAny = xNA->getByName( rImageName ); OUString aTmp; @@ -1204,8 +1204,8 @@ bool SvtLinguConfig::HasGrammarChecker() const try { uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( OUString("ServiceManager") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( OUString("GrammarCheckerList") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName("GrammarCheckerList"), uno::UNO_QUERY_THROW ); uno::Sequence< OUString > aElementNames( xNA->getElementNames() ); bRes = aElementNames.getLength() > 0; diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index 8e5cfc69e875..bda16c36e9f0 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -1277,13 +1277,13 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const OUString ::comphelper::SequenceAsHashMap stlDesc(lMediaDescriptor); // is there already a filter inside the descriptor? - OUString sFilterName = stlDesc.getUnpackedValueOrDefault(OUString("FilterName"), OUString()); + OUString sFilterName = stlDesc.getUnpackedValueOrDefault("FilterName", OUString()); if (!sFilterName.isEmpty()) { try { ::comphelper::SequenceAsHashMap stlFilterProps (xFilterCfg->getByName(sFilterName)); - OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(OUString("DocumentService"), OUString()); + OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault("DocumentService", OUString()); SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService); if (eApp != E_UNKNOWN_FACTORY) @@ -1296,7 +1296,7 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const OUString } // is there already a type inside the descriptor? - OUString sTypeName = stlDesc.getUnpackedValueOrDefault(OUString("TypeName"), OUString()); + OUString sTypeName = stlDesc.getUnpackedValueOrDefault("TypeName", OUString()); if (sTypeName.isEmpty()) { // no :-( @@ -1313,9 +1313,9 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const OUString try { ::comphelper::SequenceAsHashMap stlTypeProps (xTypeCfg->getByName(sTypeName)); - OUString sPreferredFilter = stlTypeProps.getUnpackedValueOrDefault(OUString("PreferredFilter"), OUString()); + OUString sPreferredFilter = stlTypeProps.getUnpackedValueOrDefault("PreferredFilter", OUString()); ::comphelper::SequenceAsHashMap stlFilterProps (xFilterCfg->getByName(sPreferredFilter)); - OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(OUString("DocumentService"), OUString()); + OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault("DocumentService", OUString()); SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService); if (eApp != E_UNKNOWN_FACTORY) diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx index 82b869f1940b..efa9e4690603 100644 --- a/unotools/source/ucbhelper/ucbhelper.cxx +++ b/unotools/source/ucbhelper/ucbhelper.cxx @@ -190,7 +190,7 @@ bool utl::UCBContentHelper::GetTitle( { assert(title != 0); try { - return content(url).getPropertyValue(OUString("Title")) >>= *title; + return content(url).getPropertyValue("Title") >>= *title; } catch (css::uno::RuntimeException const &) { throw; } catch (css::ucb::CommandAbortedException const &) { @@ -296,7 +296,7 @@ bool utl::UCBContentHelper::MakeFolder( sal_Int64 utl::UCBContentHelper::GetSize(OUString const & url) { try { sal_Int64 n = 0; - bool ok = (content(url).getPropertyValue(OUString("Size")) >>= n); + bool ok = (content(url).getPropertyValue("Size") >>= n); SAL_INFO_IF( !ok, "unotools.ucbhelper", "UCBContentHelper::GetSize(" << url -- cgit v1.2.3