diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-12-12 17:52:47 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-12-12 17:52:47 +0100 |
commit | d2177cded64d92a8c6f068192d1c4b023d49edf3 (patch) | |
tree | 3f1db32788aaf1a13bed18d211dd0404c1e81844 /sfx2 | |
parent | 58138d117dae2a2778e5e62ca20066744d42804d (diff) |
sfx2: Use appropriate OUString functions on string constants
Change-Id: I28ca30da980b81dbf3328495291916afca654999
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/helpdispatch.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/DocumentMetadataAccess.cxx | 40 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/doc/printhelper.cxx | 25 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/zoomitem.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/sidebar/CommandInfoProvider.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/Context.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/sidebar/ResourceManager.cxx | 18 |
10 files changed, 48 insertions, 59 deletions
diff --git a/sfx2/source/appl/helpdispatch.cxx b/sfx2/source/appl/helpdispatch.cxx index 5173c4e32563..8ae6135e24a7 100644 --- a/sfx2/source/appl/helpdispatch.cxx +++ b/sfx2/source/appl/helpdispatch.cxx @@ -64,7 +64,7 @@ void SAL_CALL HelpDispatch_Impl::dispatch( const PropertyValue* pEnd = pBegin + aArgs.getLength(); for ( ; pBegin != pEnd; ++pBegin ) { - if ( pBegin->Name.equalsAscii( "HelpKeyword" ) ) + if ( pBegin->Name == "HelpKeyword" ) { OUString sHelpKeyword; if ( ( pBegin->Value >>= sHelpKeyword ) && !sHelpKeyword.isEmpty() ) diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index ba0ea7c94e7d..fd356017fa6f 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -290,7 +290,7 @@ SfxStatusDispatcher::SfxStatusDispatcher() void SAL_CALL SfxStatusDispatcher::addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & aListener, const ::com::sun::star::util::URL& aURL) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) { aListeners.addInterface( aURL.Complete, aListener ); - if ( aURL.Complete.equalsAscii(".uno:LifeTime") ) + if ( aURL.Complete == ".uno:LifeTime" ) { ::com::sun::star::frame::FeatureStateEvent aEvent; aEvent.FeatureURL = aURL; diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index cff6c8ca14b2..cb6799fbfd9f 100644 --- a/sfx2/source/doc/DocumentMetadataAccess.cxx +++ b/sfx2/source/doc/DocumentMetadataAccess.cxx @@ -161,7 +161,7 @@ uno::Reference<rdf::XURI> createBaseURI( xBaseURI.set( xPkgURI, uno::UNO_SET_THROW ); } OUStringBuffer buf; - if (!xBaseURI->getUriReference().endsWithAsciiL("/", 1)) + if (!xBaseURI->getUriReference().endsWith("/")) { const sal_Int32 count( xBaseURI->getPathSegmentCount() ); if (count > 0) @@ -552,8 +552,7 @@ readStream(struct DocumentMetadataAccess_Impl & i_rImpl, xDirProps->getPropertyValue( utl::MediaDescriptor::PROP_MEDIATYPE() ) >>= mimeType; - if (mimeType.matchAsciiL(s_odfmime, sizeof(s_odfmime) - 1)) - { + if (mimeType.startsWith(s_odfmime)) { OSL_TRACE("readStream: " "refusing to recurse into embedded document"); return; @@ -655,7 +654,7 @@ writeStream(struct DocumentMetadataAccess_Impl & i_rImpl, xDirProps->getPropertyValue( utl::MediaDescriptor::PROP_MEDIATYPE() ) >>= mimeType; - if (mimeType.matchAsciiL(s_odfmime, sizeof(s_odfmime) - 1)) { + if (mimeType.startsWith(s_odfmime)) { OSL_TRACE("writeStream: " "refusing to recurse into embedded document"); return; @@ -695,8 +694,6 @@ retry: i_rImpl.m_xRepository.set(rdf::Repository::create(i_rImpl.m_xContext), uno::UNO_SET_THROW); - const OUString manifest ( - OUString::createFromAscii(s_manifest)); const OUString baseURI( i_xBaseURI->getStringValue() ); // try to delay raising errors until after initialization is done uno::Any rterr; @@ -704,9 +701,9 @@ retry: bool err(false); const uno::Reference <rdf::XURI> xManifest( - getURIForStream(i_rImpl, manifest)); + getURIForStream(i_rImpl, s_manifest)); try { - readStream(i_rImpl, i_xStorage, manifest, baseURI); + readStream(i_rImpl, i_xStorage, s_manifest, baseURI); } catch (const ucb::InteractiveAugmentedIOException & e) { // no manifest.rdf: this is not an error in ODF < 1.2 if (!(ucb::IOErrorCode_NOT_EXISTING_PATH == e.Code)) { @@ -754,8 +751,7 @@ static void init(struct DocumentMetadataAccess_Impl & i_rImpl) try { i_rImpl.m_xManifest.set(i_rImpl.m_xRepository->createGraph( - getURIForStream(i_rImpl, - OUString::createFromAscii(s_manifest))), + getURIForStream(i_rImpl, s_manifest)), uno::UNO_SET_THROW); // insert the document statement @@ -769,12 +765,10 @@ static void init(struct DocumentMetadataAccess_Impl & i_rImpl) } // add top-level content files - if (!addContentOrStylesFileImpl(i_rImpl, - OUString::createFromAscii(s_content))) { + if (!addContentOrStylesFileImpl(i_rImpl, s_content)) { throw uno::RuntimeException(); } - if (!addContentOrStylesFileImpl(i_rImpl, - OUString::createFromAscii(s_styles))) { + if (!addContentOrStylesFileImpl(i_rImpl, s_styles)) { throw uno::RuntimeException(); } } @@ -796,8 +790,8 @@ DocumentMetadataAccess::DocumentMetadataAccess( : m_pImpl(new DocumentMetadataAccess_Impl(i_xContext, i_rRegistrySupplier)) { OSL_ENSURE(!i_rURI.isEmpty(), "DMA::DMA: no URI given!"); - OSL_ENSURE(i_rURI.endsWithAsciiL("/", 1), "DMA::DMA: URI without / given!"); - if (!i_rURI.endsWithAsciiL("/", 1)) throw uno::RuntimeException(); + OSL_ENSURE(i_rURI.endsWith("/"), "DMA::DMA: URI without / given!"); + if (!i_rURI.endsWith("/")) throw uno::RuntimeException(); m_pImpl->m_xBaseURI.set(rdf::URI::create(m_pImpl->m_xContext, i_rURI)); m_pImpl->m_xRepository.set(rdf::Repository::create(m_pImpl->m_xContext), uno::UNO_SET_THROW); @@ -1092,7 +1086,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, "DocumentMetadataAccess::loadMetadataFromStorage: " "base URI not absolute", *this, 1); } - if (baseURI.isEmpty() || !baseURI.endsWithAsciiL("/", 1)) { + if (!baseURI.endsWith("/")) { throw lang::IllegalArgumentException( "DocumentMetadataAccess::loadMetadataFromStorage: " "base URI does not end with slash", *this, 1); @@ -1116,8 +1110,6 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, const uno::Reference<rdf::XURI> xMetadataFile( getURI<rdf::URIs::PKG_METADATAFILE>(m_pImpl->m_xContext)); const sal_Int32 len( baseURI.getLength() ); - const OUString manifest ( - OUString::createFromAscii(s_manifest)); for (::std::vector< uno::Reference< rdf::XURI > >::const_iterator it = parts.begin(); it != parts.end(); ++it) { @@ -1129,7 +1121,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, continue; } const OUString relName( name.copy(len) ); - if (relName == manifest) { + if (relName == s_manifest) { OSL_TRACE("loadMetadataFromStorage: " "found ourselves a recursive manifest!"); continue; @@ -1193,13 +1185,11 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, } // export manifest - const OUString manifest ( - OUString::createFromAscii(s_manifest)); const uno::Reference <rdf::XURI> xManifest( - getURIForStream(*m_pImpl, manifest) ); + getURIForStream(*m_pImpl, s_manifest) ); const OUString baseURI( m_pImpl->m_xBaseURI->getStringValue() ); try { - writeStream(*m_pImpl, i_xStorage, xManifest, manifest, baseURI); + writeStream(*m_pImpl, i_xStorage, xManifest, s_manifest, baseURI); } catch (const uno::RuntimeException &) { throw; } catch (const io::IOException & e) { @@ -1225,7 +1215,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, continue; } const OUString relName( name.copy(len) ); - if (relName == manifest) { + if (relName == s_manifest) { continue; } if (!isFileNameValid(relName) || isReservedFile(relName)) { diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 3b8a9b6e1198..a51fdaa63c69 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -2542,9 +2542,9 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList, if ( rUITitle.isEmpty() ) { // reserved FS names that should not be used - if ( rTitle.equalsAscii( "wizard" ) ) + if ( rTitle == "wizard" ) return; - else if ( rTitle.equalsAscii( "internal" ) ) + else if ( rTitle == "internal" ) return; aTitle = getLongName( rTitle ); @@ -2607,7 +2607,7 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList, OUString aType; OUString aHierURL; - if ( aChildTitle.equalsAscii( "sfx.tlx" ) || aChildTitle == "groupuinames.xml" ) + if ( aChildTitle == "sfx.tlx" || aChildTitle == "groupuinames.xml" ) continue; bool bDocHasTitle = false; diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 56a64a56a07f..27f2e62981f5 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -335,7 +335,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > const beans::PropertyValue &rProp = rPrinter.getConstArray()[n]; // Name-Property? - if ( rProp.Name.equalsAscii( "Name" ) ) + if ( rProp.Name == "Name" ) { OUString aPrinterName; if ( ! ( rProp.Value >>= aPrinterName ) ) @@ -360,7 +360,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > const beans::PropertyValue &rProp = rPrinter.getConstArray()[i]; // PaperOrientation-Property? - if ( rProp.Name.equalsAscii( "PaperOrientation" ) ) + if ( rProp.Name == "PaperOrientation" ) { view::PaperOrientation eOrient; if ( !( rProp.Value >>= eOrient ) ) @@ -378,7 +378,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > } // PaperFormat-Property? - else if ( rProp.Name.equalsAscii( "PaperFormat" ) ) + else if ( rProp.Name == "PaperFormat" ) { if ( !( rProp.Value >>= nPaperFormat ) ) { @@ -395,7 +395,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > } // PaperSize-Property? - else if ( rProp.Name.equalsAscii( "PaperSize" ) ) + else if ( rProp.Name == "PaperSize" ) { awt::Size aTempSize ; if ( !( rProp.Value >>= aTempSize ) ) @@ -409,7 +409,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > } // PrinterTray-Property - else if ( rProp.Name.equalsAscii( "PrinterPaperTray" ) ) + else if ( rProp.Name == "PrinterPaperTray" ) { OUString aTmp; if ( !( rProp.Value >>= aTmp ) ) @@ -620,7 +620,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& const beans::PropertyValue &rProp = rOptions.getConstArray()[n]; // FileName-Property? - if ( rProp.Name.equalsAscii( "FileName" ) ) + if ( rProp.Name == "FileName" ) { // unpack th URL and check for a valid and well known protocol OUString sTemp; @@ -695,7 +695,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& } // CopyCount-Property - else if ( rProp.Name.equalsAscii( "CopyCount" ) ) + else if ( rProp.Name == "CopyCount" ) { sal_Int32 nCopies = 0; if ( !( rProp.Value >>= nCopies ) ) @@ -707,8 +707,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // Collate-Property // Sort-Property (deprecated) - else if ( rProp.Name.equalsAscii( "Collate" ) || - rProp.Name.equalsAscii( "Sort" ) ) + else if ( rProp.Name == "Collate" || rProp.Name == "Sort" ) { bool bTemp; if ( rProp.Value >>= bTemp ) @@ -721,7 +720,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& } // Pages-Property - else if ( rProp.Name.equalsAscii( "Pages" ) ) + else if ( rProp.Name == "Pages" ) { OUString sTemp; if( rProp.Value >>= sTemp ) @@ -734,7 +733,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& } // MonitorVisible - else if ( rProp.Name.equalsAscii( "MonitorVisible" ) ) + else if ( rProp.Name == "MonitorVisible" ) { if( !(rProp.Value >>= bMonitor) ) throw ::com::sun::star::lang::IllegalArgumentException(); @@ -743,7 +742,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& } // Wait - else if ( rProp.Name.equalsAscii( "Wait" ) ) + else if ( rProp.Name == "Wait" ) { if ( !(rProp.Value >>= bWaitUntilEnd) ) throw ::com::sun::star::lang::IllegalArgumentException(); @@ -751,7 +750,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& aCheckedArgs[nProps++].Value <<= bWaitUntilEnd; } - else if ( rProp.Name.equalsAscii( "DuplexMode" ) ) + else if ( rProp.Name == "DuplexMode" ) { if ( !(rProp.Value >>= nDuplexMode ) ) throw ::com::sun::star::lang::IllegalArgumentException(); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 090a4552c7ac..ebb924bf0359 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -289,7 +289,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument } uri = xContent->getIdentifier()->getContentIdentifier(); OSL_ENSURE(!uri.isEmpty(), "GetDMA: empty uri?"); - if (!uri.isEmpty() && !uri.endsWithAsciiL("/", 1)) + if (!uri.isEmpty() && !uri.endsWith("/")) { uri = uri + "/"; } diff --git a/sfx2/source/doc/zoomitem.cxx b/sfx2/source/doc/zoomitem.cxx index 0b9d11cfedaa..20c93d81dbd2 100644 --- a/sfx2/source/doc/zoomitem.cxx +++ b/sfx2/source/doc/zoomitem.cxx @@ -152,17 +152,17 @@ bool SvxZoomItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMem sal_Int16 nConvertedCount( 0 ); for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ ) { - if ( aSeq[i].Name.equalsAscii( ZOOM_PARAM_VALUE )) + if ( aSeq[i].Name == ZOOM_PARAM_VALUE ) { bAllConverted &= ( aSeq[i].Value >>= nValueTmp ); ++nConvertedCount; } - else if ( aSeq[i].Name.equalsAscii( ZOOM_PARAM_VALUESET )) + else if ( aSeq[i].Name == ZOOM_PARAM_VALUESET ) { bAllConverted &= ( aSeq[i].Value >>= nValueSetTmp ); ++nConvertedCount; } - else if ( aSeq[i].Name.equalsAscii( ZOOM_PARAM_TYPE )) + else if ( aSeq[i].Name == ZOOM_PARAM_TYPE ) { bAllConverted &= ( aSeq[i].Value >>= nTypeTmp ); ++nConvertedCount; diff --git a/sfx2/source/sidebar/CommandInfoProvider.cxx b/sfx2/source/sidebar/CommandInfoProvider.cxx index 5e9fb2a81aea..0f0d957527de 100644 --- a/sfx2/source/sidebar/CommandInfoProvider.cxx +++ b/sfx2/source/sidebar/CommandInfoProvider.cxx @@ -325,7 +325,7 @@ OUString CommandInfoProvider::GetCommandLabel (const OUString& rsCommandName) const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName)); for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex) { - if (aProperties[nIndex].Name.equalsAscii("Name")) + if (aProperties[nIndex].Name == "Name") { OUString sLabel; aProperties[nIndex].Value >>= sLabel; diff --git a/sfx2/source/sidebar/Context.cxx b/sfx2/source/sidebar/Context.cxx index df0d43c0dfcf..ab6dadfe29f4 100644 --- a/sfx2/source/sidebar/Context.cxx +++ b/sfx2/source/sidebar/Context.cxx @@ -51,11 +51,11 @@ Context::Context ( sal_Int32 Context::EvaluateMatch ( const Context& rOther) const { - const bool bApplicationNameIsAny (rOther.msApplication.equalsAscii(AnyApplicationName)); + const bool bApplicationNameIsAny (rOther.msApplication == AnyApplicationName); if (rOther.msApplication.equals(msApplication) || bApplicationNameIsAny) { // Application name matches. - const bool bContextNameIsAny (rOther.msContext.equalsAscii(AnyContextName)); + const bool bContextNameIsAny (rOther.msContext == AnyContextName); if (rOther.msContext.equals(msContext) || bContextNameIsAny) { // Context name matches. diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 3220762be330..966c0ddb5163 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -382,7 +382,7 @@ void ResourceManager::ReadContextList ( : sValue.getToken(0, ',', nCharacterIndex).trim()); const OUString sMenuCommand ( sMenuCommandOverride.getLength()>0 - ? (sMenuCommandOverride.equalsAscii("none") + ? (sMenuCommandOverride == "none" ? OUString() : sMenuCommandOverride) : rsDefaultMenuCommand); @@ -398,15 +398,15 @@ void ResourceManager::ReadContextList ( { // Handle some special names: abbreviations that make // context descriptions more readable. - if (sApplicationName.equalsAscii("Writer")) + if (sApplicationName == "Writer") aApplications.push_back(EnumContext::Application_Writer); - else if (sApplicationName.equalsAscii("Calc")) + else if (sApplicationName == "Calc") aApplications.push_back(EnumContext::Application_Calc); - else if (sApplicationName.equalsAscii("Draw")) + else if (sApplicationName == "Draw") aApplications.push_back(EnumContext::Application_Draw); - else if (sApplicationName.equalsAscii("Impress")) + else if (sApplicationName == "Impress") aApplications.push_back(EnumContext::Application_Impress); - else if (sApplicationName.equalsAscii("DrawImpress")) + else if (sApplicationName == "DrawImpress") { // A special case among the special names: it is // common to use the same context descriptions for @@ -415,7 +415,7 @@ void ResourceManager::ReadContextList ( aApplications.push_back(EnumContext::Application_Draw); aApplications.push_back(EnumContext::Application_Impress); } - else if (sApplicationName.equalsAscii("WriterVariants")) + else if (sApplicationName == "WriterVariants") { // Another special case for all Writer variants. aApplications.push_back(EnumContext::Application_Writer); @@ -448,9 +448,9 @@ void ResourceManager::ReadContextList ( // Setup the flag that controls whether a deck/pane is // initially visible/expanded. bool bIsInitiallyVisible; - if (sInitialState.equalsAscii("visible")) + if (sInitialState == "visible") bIsInitiallyVisible = true; - else if (sInitialState.equalsAscii("hidden")) + else if (sInitialState == "hidden") bIsInitiallyVisible = false; else { |