From fb847101519ad74c02183672c04ebf1d700aae83 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 10 Dec 2013 08:31:13 +0200 Subject: simplify - use OUString::startsWith where possible Convert code like if( !aStr.isEmpty() && aStr[0] == 'x' ) to if( aStr.startsWith("x") ) Change-Id: Iabc3a44ed3be2d29eed876e0eeef212ccd271edf --- sfx2/source/appl/appopen.cxx | 2 +- sfx2/source/bastyp/fltfnc.cxx | 2 +- sfx2/source/dialog/splitwin.cxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index e8e23c5d1a4c..c15ce4296198 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -1051,7 +1051,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) // make URL ready SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, SID_FILE_NAME, sal_False ); aFileName = pURLItem->GetValue(); - if( !aFileName.isEmpty() && aFileName[0] == '#' ) // Mark without URL + if( aFileName.startsWith("#") ) // Mark without URL { SfxViewFrame *pView = pTargetFrame ? pTargetFrame->GetCurrentViewFrame() : 0; if ( !pView ) diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 65974d01b0f7..fd1c75d2c60b 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -747,7 +747,7 @@ const SfxFilter* SfxFilterMatcher::GetFilter4Extension( const OUString& rExt, Sf // Use extension without dot! OUString sExt( rExt ); - if ( !sExt.isEmpty() && ( sExt[0] == (sal_Unicode)'.' )) + if ( sExt.startsWith(".") ) sExt = sExt.copy(1); com::sun::star::uno::Sequence < com::sun::star::beans::NamedValue > aSeq(1); diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx index 15ffacfb8716..f229df6e8fe5 100644 --- a/sfx2/source/dialog/splitwin.cxx +++ b/sfx2/source/dialog/splitwin.cxx @@ -272,7 +272,7 @@ SfxSplitWindow::SfxSplitWindow( Window* pParent, SfxChildAlignment eAl, OUString aTemp; if ( aUserItem >>= aTemp ) aWinData = aTemp; - if ( !aWinData.isEmpty() && aWinData[0] == 'V' ) + if ( aWinData.startsWith("V") ) { pEmptyWin->nState = (sal_uInt16) aWinData.getToken( 1, ',' ).toInt32(); if ( pEmptyWin->nState & 2 ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index f7196d83a520..14ca59fbfded 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -290,7 +290,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument OSL_ENSURE(!uri.isEmpty(), "GetDMA: empty uri?"); if (!uri.isEmpty() && !uri.endsWithAsciiL("/", 1)) { - uri = uri + OUString("/"); + uri = uri + "/"; } m_xDocumentMetadata = new ::sfx2::DocumentMetadataAccess( -- cgit