From 7c0c3362de894ddd4526f56e1849f116eb25cedd Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Wed, 21 Dec 2011 19:54:11 -0200 Subject: Fix for fdo43460 Part XV getLength() to isEmpty() Part XV Module embeddeobj --- embeddedobj/source/commonembedding/persistence.cxx | 34 +++++++++++----------- embeddedobj/source/commonembedding/xfactory.cxx | 22 +++++++------- embeddedobj/source/general/docholder.cxx | 8 ++--- embeddedobj/source/general/dummyobject.cxx | 4 +-- embeddedobj/source/general/xcreator.cxx | 24 +++++++-------- embeddedobj/source/msole/oleembed.cxx | 20 ++++++------- embeddedobj/source/msole/olemisc.cxx | 4 +-- embeddedobj/source/msole/olepersist.cxx | 24 +++++++-------- embeddedobj/source/msole/ownview.cxx | 26 ++++++++--------- embeddedobj/source/msole/xolefactory.cxx | 10 +++---- 10 files changed, 88 insertions(+), 88 deletions(-) (limited to 'embeddedobj') diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 8afe92d881b1..654e221ee892 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -246,7 +246,7 @@ static void SetDocToEmbedded( const uno::Reference< frame::XModel > xDocument, c aSeq[0].Value <<= sal_True; xDocument->attachResource( ::rtl::OUString(), aSeq ); - if ( aModuleName.getLength() ) + if ( !aModuleName.isEmpty() ) { try { @@ -465,7 +465,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() ::rtl::OUString OCommonEmbeddedObject::GetFilterName( sal_Int32 nVersion ) const { ::rtl::OUString aFilterName = GetPresetFilterName(); - if ( !aFilterName.getLength() ) + if ( aFilterName.isEmpty() ) { try { ::comphelper::MimeConfigurationHelper aHelper( m_xFactory ); @@ -486,8 +486,8 @@ void OCommonEmbeddedObject::FillDefaultLoadArgs_Impl( const uno::Reference< embe o_rLoadArgs.put( "ReadOnly", m_bReadOnly ); ::rtl::OUString aFilterName = GetFilterName( ::comphelper::OStorageHelper::GetXStorageFormat( i_rxStorage ) ); - OSL_ENSURE( aFilterName.getLength(), "OCommonEmbeddedObject::FillDefaultLoadArgs_Impl: Wrong document service name!" ); - if ( !aFilterName.getLength() ) + OSL_ENSURE( !aFilterName.isEmpty(), "OCommonEmbeddedObject::FillDefaultLoadArgs_Impl: Wrong document service name!" ); + if ( aFilterName.isEmpty() ) throw io::IOException(); // TODO: error message/code o_rLoadArgs.put( "FilterName", aFilterName ); @@ -543,7 +543,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag { } - OSL_ENSURE( aTempFileURL.getLength(), "Coudn't retrieve temporary file URL!\n" ); + OSL_ENSURE( !aTempFileURL.isEmpty(), "Coudn't retrieve temporary file URL!\n" ); aLoadArgs.put( "URL", aTempFileURL ); aLoadArgs.put( "InputStream", xTempInpStream ); @@ -613,8 +613,8 @@ uno::Reference< io::XInputStream > OCommonEmbeddedObject::StoreDocumentToTempStr ::rtl::OUString aFilterName = GetFilterName( nStorageFormat ); - OSL_ENSURE( aFilterName.getLength(), "Wrong document service name!" ); - if ( !aFilterName.getLength() ) + OSL_ENSURE( !aFilterName.isEmpty(), "Wrong document service name!" ); + if ( aFilterName.isEmpty() ) throw io::IOException(); // TODO: uno::Sequence< beans::PropertyValue > aArgs( 4 ); @@ -692,7 +692,7 @@ void OCommonEmbeddedObject::SaveObject_Impl() {} } - if ( !aBaseURL.getLength() ) + if ( aBaseURL.isEmpty() ) { for ( nInd = 0; nInd < m_aDocMediaDescriptor.getLength(); nInd++ ) if ( m_aDocMediaDescriptor[nInd].Name.equals( @@ -703,7 +703,7 @@ void OCommonEmbeddedObject::SaveObject_Impl() } } - if ( !aBaseURL.getLength() ) + if ( aBaseURL.isEmpty() ) aBaseURL = m_aDefaultParentBaseURL; return aBaseURL; @@ -724,7 +724,7 @@ void OCommonEmbeddedObject::SaveObject_Impl() break; } - if ( !aBaseURL.getLength() ) + if ( aBaseURL.isEmpty() ) { for ( nInd = 0; nInd < lObjArgs.getLength(); nInd++ ) if ( lObjArgs[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultParentBaseURL" ) ) ) ) @@ -775,8 +775,8 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed: { ::rtl::OUString aFilterName = GetFilterName( nStorageFormat ); - OSL_ENSURE( aFilterName.getLength(), "Wrong document service name!" ); - if ( !aFilterName.getLength() ) + OSL_ENSURE( !aFilterName.isEmpty(), "Wrong document service name!" ); + if ( aFilterName.isEmpty() ) throw io::IOException(); // TODO: uno::Sequence< beans::PropertyValue > aArgs( 3 ); @@ -896,7 +896,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateTempDocFromLink_ { } - OSL_ENSURE( aTempFileURL.getLength(), "Couldn't retrieve temporary file URL!\n" ); + OSL_ENSURE( !aTempFileURL.isEmpty(), "Couldn't retrieve temporary file URL!\n" ); aTempMediaDescr[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "URL" )); aTempMediaDescr[0].Value <<= aTempFileURL; @@ -948,7 +948,7 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); @@ -1717,9 +1717,9 @@ void SAL_CALL OCommonEmbeddedObject::reload( } ::comphelper::MimeConfigurationHelper aHelper( m_xFactory ); - if ( !m_aLinkFilterName.getLength() ) + if ( m_aLinkFilterName.isEmpty() ) { - if ( aNewLinkFilter.getLength() ) + if ( !aNewLinkFilter.isEmpty() ) m_aLinkFilterName = aNewLinkFilter; else { @@ -1814,7 +1814,7 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XSt uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); diff --git a/embeddedobj/source/commonembedding/xfactory.cxx b/embeddedobj/source/commonembedding/xfactory.cxx index e12a939f88c9..56662e95fa67 100644 --- a/embeddedobj/source/commonembedding/xfactory.cxx +++ b/embeddedobj/source/commonembedding/xfactory.cxx @@ -85,7 +85,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); @@ -176,7 +176,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); @@ -189,7 +189,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta uno::Reference< uno::XInterface > xResult; // find document service name - if ( aFilterName.getLength() ) + if ( !aFilterName.isEmpty() ) { uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByFilter( aFilterName ); if ( !aObject.getLength() ) @@ -243,7 +243,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 3 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 4 ); @@ -295,7 +295,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); @@ -308,7 +308,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta if ( nEntryConnectionMode == embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT ) { ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, aObject ); - if ( !aFilterName.getLength() ) + if ( aFilterName.isEmpty() ) // the object must be OOo embedded object, if it is not an exception must be thrown throw io::IOException(); // TODO: } @@ -359,14 +359,14 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta if ( aTempMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) ) ) aTempMedDescr[nInd].Value >>= aURL; - if ( !aURL.getLength() ) + if ( aURL.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No URL for the link is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 3 ); ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, sal_False ); - if ( aFilterName.getLength() ) + if ( !aFilterName.isEmpty() ) { uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByFilter( aFilterName ); if ( !aObject.getLength() ) @@ -413,7 +413,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); @@ -425,7 +425,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta if ( aTempMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) ) ) aTempMedDescr[nInd].Value >>= aURL; - if ( !aURL.getLength() ) + if ( aURL.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No URL for the link is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 3 ); @@ -436,7 +436,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, aObject ); - if ( aFilterName.getLength() ) + if ( !aFilterName.isEmpty() ) { xResult = uno::Reference< uno::XInterface >( diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index 2ba23df02744..c0b4990d3576 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -126,7 +126,7 @@ static void InsertMenu_Impl( const uno::Reference< container::XIndexContainer >& for ( nInd = 0; nInd < aSourceProps.getLength(); nInd++ ) { aTargetProps[nInd].Name = aSourceProps[nInd].Name; - if ( aContModuleName.getLength() && aTargetProps[nInd].Name.equals( aModuleIdentPropName ) ) + if ( !aContModuleName.isEmpty() && aTargetProps[nInd].Name.equals( aModuleIdentPropName ) ) { aTargetProps[nInd].Value <<= aContModuleName; bModuleNameSet = sal_True; @@ -140,7 +140,7 @@ static void InsertMenu_Impl( const uno::Reference< container::XIndexContainer >& aTargetProps[nInd].Value = aSourceProps[nInd].Value; } - if ( !bModuleNameSet && aContModuleName.getLength() ) + if ( !bModuleNameSet && !aContModuleName.isEmpty() ) { aTargetProps.realloc( ++nInd ); aTargetProps[nInd-1].Name = aModuleIdentPropName; @@ -582,7 +582,7 @@ uno::Reference< container::XIndexAccess > DocumentHolder::RetrieveOwnMenu_Impl() ::rtl::OUString aModuleIdent = xModuleMan->identify( uno::Reference< uno::XInterface >( m_xComponent, uno::UNO_QUERY ) ); - if ( aModuleIdent.getLength() ) + if ( !aModuleIdent.isEmpty() ) { uno::Reference< ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier > xModConfSupplier( m_xFactory->createInstance( ::rtl::OUString( @@ -623,7 +623,7 @@ void DocumentHolder::FindConnectPoints( break; } - if ( !aCommand.getLength() ) + if ( aCommand.isEmpty() ) throw uno::RuntimeException(); if ( aCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ".uno:PickList" ) ) ) diff --git a/embeddedobj/source/general/dummyobject.cxx b/embeddedobj/source/general/dummyobject.cxx index c5cd7b1adf6c..d5a7fc54f7ba 100644 --- a/embeddedobj/source/general/dummyobject.cxx +++ b/embeddedobj/source/general/dummyobject.cxx @@ -325,7 +325,7 @@ void SAL_CALL ODummyEmbeddedObject::setPersistentEntry( uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); @@ -469,7 +469,7 @@ sal_Bool SAL_CALL ODummyEmbeddedObject::hasEntry() ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); - if ( m_aEntryName.getLength() ) + if ( !m_aEntryName.isEmpty() ) return sal_True; return sal_False; diff --git a/embeddedobj/source/general/xcreator.cxx b/embeddedobj/source/general/xcreator.cxx index 235dd7f343c9..607fe2260c8b 100644 --- a/embeddedobj/source/general/xcreator.cxx +++ b/embeddedobj/source/general/xcreator.cxx @@ -89,13 +89,13 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 3 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 4 ); ::rtl::OUString aEmbedFactory = m_aConfigHelper.GetFactoryNameByClassID( aClassID ); - if ( !aEmbedFactory.getLength() ) + if ( aEmbedFactory.isEmpty() ) { // use system fallback // TODO: in future users factories can be tested @@ -132,7 +132,7 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); @@ -209,11 +209,11 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta } } - OSL_ENSURE( aMediaType.getLength(), "No media type is specified for the object!" ); - if ( aMediaType.getLength() && !aEmbedFactory.getLength() ) + OSL_ENSURE( !aMediaType.isEmpty(), "No media type is specified for the object!" ); + if ( !aMediaType.isEmpty() && aEmbedFactory.isEmpty() ) aEmbedFactory = m_aConfigHelper.GetFactoryNameByMediaType( aMediaType ); - if ( aEmbedFactory.getLength() ) + if ( !aEmbedFactory.isEmpty() ) { uno::Reference< uno::XInterface > xFact = m_xFactory->createInstance( aEmbedFactory ); @@ -253,7 +253,7 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); @@ -264,7 +264,7 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta // check if there is FilterName ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, sal_False ); - if ( aFilterName.getLength() ) + if ( !aFilterName.isEmpty() ) { // the object can be loaded by one of the office application uno::Reference< embed::XEmbedObjectCreator > xOOoEmbCreator( @@ -326,7 +326,7 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 3 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 4 ); @@ -370,14 +370,14 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta if ( aTempMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) ) ) aTempMedDescr[nInd].Value >>= aURL; - if ( !aURL.getLength() ) + if ( aURL.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No URL for the link is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 3 ); ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, sal_False ); - if ( aFilterName.getLength() ) + if ( !aFilterName.isEmpty() ) { // the object can be loaded by one of the office application uno::Reference< embed::XLinkCreator > xOOoLinkCreator( @@ -409,7 +409,7 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta static_cast< ::cppu::OWeakObject* >(this) ), 3 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index 65bbb0d32c2f..d4c9e2ef4f73 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -238,7 +238,7 @@ uno::Reference< embed::XStorage > OleEmbeddedObject::CreateTemporarySubstorage( ::rtl::OUString OleEmbeddedObject::MoveToTemporarySubstream() { ::rtl::OUString aResult; - for ( sal_Int32 nInd = 0; nInd < 32000 && !aResult.getLength(); nInd++ ) + for ( sal_Int32 nInd = 0; nInd < 32000 && aResult.isEmpty(); nInd++ ) { ::rtl::OUString aName = ::rtl::OUString::valueOf( nInd ); aName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TMPSTREAM" ) ); @@ -250,7 +250,7 @@ uno::Reference< embed::XStorage > OleEmbeddedObject::CreateTemporarySubstorage( } } - if ( !aResult.getLength() ) + if ( aResult.isEmpty() ) throw uno::RuntimeException(); return aResult; @@ -278,7 +278,7 @@ sal_Bool OleEmbeddedObject::TryToConvertToOOo() ::rtl::OUString aFilterName = OwnView_Impl::GetFilterNameFromExtentionAndInStream( m_xFactory, ::rtl::OUString(), m_xObjectStream->getInputStream() ); // use the solution only for OOXML format currently - if ( aFilterName.getLength() + if ( !aFilterName.isEmpty() && ( aFilterName.equals( ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "Calc MS Excel 2007 XML" ) ) ) || aFilterName.equals( ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "Impress MS PowerPoint 2007 XML" ) ) ) || aFilterName.equals( ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "MS Word 2007 XML" ) ) ) ) ) @@ -297,7 +297,7 @@ sal_Bool OleEmbeddedObject::TryToConvertToOOo() aFilterData[nInd].Value >>= aDocServiceName; } - if ( aDocServiceName.getLength() ) + if ( !aDocServiceName.isEmpty() ) { // create the model uno::Sequence< uno::Any > aArguments(1); @@ -342,10 +342,10 @@ sal_Bool OleEmbeddedObject::TryToConvertToOOo() // look for the related embedded object factory ::comphelper::MimeConfigurationHelper aConfigHelper( m_xFactory ); ::rtl::OUString aEmbedFactory; - if ( aMediaType.getLength() ) + if ( !aMediaType.isEmpty() ) aEmbedFactory = aConfigHelper.GetFactoryNameByMediaType( aMediaType ); - if ( !aEmbedFactory.getLength() ) + if ( aEmbedFactory.isEmpty() ) throw uno::RuntimeException(); uno::Reference< uno::XInterface > xFact = m_xFactory->createInstance( aEmbedFactory ); @@ -387,7 +387,7 @@ sal_Bool OleEmbeddedObject::TryToConvertToOOo() { case 4: case 3: - if ( aTmpStreamName.getLength() && aTmpStreamName != m_aEntryName ) + if ( !aTmpStreamName.isEmpty() && aTmpStreamName != m_aEntryName ) try { if ( m_xParentStorage->hasByName( m_aEntryName ) ) @@ -421,7 +421,7 @@ sal_Bool OleEmbeddedObject::TryToConvertToOOo() case 1: case 0: - if ( aStorageName.getLength() ) + if ( !aStorageName.isEmpty() ) try { m_xParentStorage->removeElement( aStorageName ); } catch( const uno::Exception& ) { OSL_FAIL( "Can not remove temporary storage!" ); } @@ -871,10 +871,10 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID ) { //Make a RO copy and see if the OS can find something to at //least display the content for us - if (!m_aTempDumpURL.getLength()) + if (m_aTempDumpURL.isEmpty()) m_aTempDumpURL = lcl_ExtractObject(m_xFactory, m_xObjectStream); - if (m_aTempDumpURL.getLength()) + if (!m_aTempDumpURL.isEmpty()) { uno::Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute( m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.system.SystemShellExecute"))), diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx index f85aa3576a6b..5947ae2bba9b 100644 --- a/embeddedobj/source/msole/olemisc.cxx +++ b/embeddedobj/source/msole/olemisc.cxx @@ -155,10 +155,10 @@ OleEmbeddedObject::~OleEmbeddedObject() } catch( const uno::Exception& ) {} } - if ( m_aTempURL.getLength() ) + if ( !m_aTempURL.isEmpty() ) KillFile_Impl( m_aTempURL, m_xFactory ); - if ( m_aTempDumpURL.getLength() ) + if ( !m_aTempDumpURL.isEmpty() ) KillFile_Impl( m_aTempDumpURL, m_xFactory ); } diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx index c428f70e2a29..9d2c23a18990 100644 --- a/embeddedobj/source/msole/olepersist.cxx +++ b/embeddedobj/source/msole/olepersist.cxx @@ -109,7 +109,7 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang: { } - if ( !aResult.getLength() ) + if ( aResult.isEmpty() ) throw uno::RuntimeException(); // TODO: can not create tempfile return aResult; @@ -125,7 +125,7 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang: ::rtl::OUString aResult = GetNewTempFileURL_Impl( xFactory ); - if ( aResult.getLength() ) + if ( !aResult.isEmpty() ) { try { uno::Reference < ucb::XSimpleFileAccess > xTempAccess( @@ -198,7 +198,7 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang: { } - if ( !aResult.getLength() ) + if ( aResult.isEmpty() ) throw io::IOException(); return aResult; @@ -590,8 +590,8 @@ sal_Bool OleEmbeddedObject::HasVisReplInStream() uno::Reference< io::XInputStream > xStream; - OSL_ENSURE( !m_pOleComponent || m_aTempURL.getLength(), "The temporary file must exist if there is a component!\n" ); - if ( m_aTempURL.getLength() ) + OSL_ENSURE( !m_pOleComponent || !m_aTempURL.isEmpty(), "The temporary file must exist if there is a component!\n" ); + if ( !m_aTempURL.isEmpty() ) { try { @@ -749,7 +749,7 @@ uno::Reference< io::XStream > OleEmbeddedObject::TryToRetrieveCachedVisualRepres if ( xStream == m_xObjectStream ) { - if ( m_aTempURL.getLength() ) + if ( !m_aTempURL.isEmpty() ) { // this is the own stream, so the temporary URL must be cleaned if it exists KillFile_Impl( m_aTempURL, m_xFactory ); @@ -948,7 +948,7 @@ void OleEmbeddedObject::OnClosed_Impl() //------------------------------------------------------ ::rtl::OUString OleEmbeddedObject::CreateTempURLEmpty_Impl() { - OSL_ENSURE( !m_aTempURL.getLength(), "The object has already the temporary file!" ); + OSL_ENSURE( m_aTempURL.isEmpty(), "The object has already the temporary file!" ); m_aTempURL = GetNewTempFileURL_Impl( m_xFactory ); return m_aTempURL; @@ -957,7 +957,7 @@ void OleEmbeddedObject::OnClosed_Impl() //------------------------------------------------------ ::rtl::OUString OleEmbeddedObject::GetTempURL_Impl() { - if ( !m_aTempURL.getLength() ) + if ( m_aTempURL.isEmpty() ) { RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::GetTempURL_Impl, tempfile creation" ); @@ -1012,7 +1012,7 @@ void OleEmbeddedObject::CreateOleComponentAndLoad_Impl( OleComponent* pOleCompon // will be detected later by olecomponent GetTempURL_Impl(); - if ( !m_aTempURL.getLength() ) + if ( m_aTempURL.isEmpty() ) throw uno::RuntimeException(); // TODO m_pOleComponent->LoadEmbeddedObject( m_aTempURL ); @@ -1352,7 +1352,7 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry( uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); @@ -1473,7 +1473,7 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry( if ( lArguments[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) ) ) lArguments[nInd].Value >>= aURL; - if ( !aURL.getLength() ) + if ( aURL.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty URL is provided in the media descriptor!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), @@ -1979,7 +1979,7 @@ void SAL_CALL OleEmbeddedObject::breakLink( const uno::Reference< embed::XStorag uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx index 9b3688e8d351..91381263134e 100644 --- a/embeddedobj/source/msole/ownview.cxx +++ b/embeddedobj/source/msole/ownview.cxx @@ -109,7 +109,7 @@ OwnView_Impl::~OwnView_Impl() } catch( uno::Exception& ) {} try { - if ( m_aNativeTempURL.getLength() ) + if ( !m_aNativeTempURL.isEmpty() ) KillFile_Impl( m_aNativeTempURL, m_xFactory ); } catch( uno::Exception& ) {} } @@ -119,7 +119,7 @@ sal_Bool OwnView_Impl::CreateModelFromURL( const ::rtl::OUString& aFileURL ) { sal_Bool bResult = sal_False; - if ( aFileURL.getLength() ) + if ( !aFileURL.isEmpty() ) { try { uno::Reference < frame::XComponentLoader > xDocumentLoader( @@ -129,7 +129,7 @@ sal_Bool OwnView_Impl::CreateModelFromURL( const ::rtl::OUString& aFileURL ) if ( xDocumentLoader.is() ) { - uno::Sequence< beans::PropertyValue > aArgs( m_aFilterName.getLength() ? 5 : 4 ); + uno::Sequence< beans::PropertyValue > aArgs( m_aFilterName.isEmpty() ? 4 : 5 ); aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "URL" )); aArgs[0].Value <<= aFileURL; @@ -144,7 +144,7 @@ sal_Bool OwnView_Impl::CreateModelFromURL( const ::rtl::OUString& aFileURL ) aArgs[3].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DontEdit" )); aArgs[3].Value <<= sal_True; - if ( m_aFilterName.getLength() ) + if ( !m_aFilterName.isEmpty() ) { aArgs[4].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilterName" )); aArgs[4].Value <<= m_aFilterName; @@ -217,19 +217,19 @@ sal_Bool OwnView_Impl::CreateModel( sal_Bool bUseNative ) ::rtl::OUString aTypeName; - if ( aNameWithExtention.getLength() ) + if ( !aNameWithExtention.isEmpty() ) { ::rtl::OUString aURLToAnalyze = ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "file:///" ) ) + aNameWithExtention ); aTypeName = xTypeDetection->queryTypeByURL( aURLToAnalyze ); } - uno::Sequence< beans::PropertyValue > aArgs( aTypeName.getLength() ? 3 : 2 ); + uno::Sequence< beans::PropertyValue > aArgs( aTypeName.isEmpty() ? 2 : 3 ); aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); aArgs[0].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:stream" ) ); aArgs[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InputStream" ) ); aArgs[1].Value <<= xInputStream; - if ( aTypeName.getLength() ) + if ( !aTypeName.isEmpty() ) { aArgs[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TypeName" ) ); aArgs[2].Value <<= aTypeName; @@ -242,7 +242,7 @@ sal_Bool OwnView_Impl::CreateModel( sal_Bool bUseNative ) if ( aArgs[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterName" ) ) ) aArgs[nInd].Value >>= aFilterName; - if ( !aFilterName.getLength() && aTypeName.getLength() ) + if ( aFilterName.isEmpty() && !aTypeName.isEmpty() ) { // get the default filter name for the type uno::Reference< container::XNameAccess > xNameAccess( xTypeDetection, uno::UNO_QUERY_THROW ); @@ -415,7 +415,7 @@ sal_Bool OwnView_Impl::ReadContentsAndGenerateTempFile( const uno::Reference< io //-------------------------------------------------------- void OwnView_Impl::CreateNative() { - if ( m_aNativeTempURL.getLength() ) + if ( !m_aNativeTempURL.isEmpty() ) return; try @@ -459,7 +459,7 @@ void OwnView_Impl::CreateNative() bOk = ReadContentsAndGenerateTempFile( xSubStream->getInputStream(), sal_True ); - if ( !bOk && m_aNativeTempURL.getLength() ) + if ( !bOk && !m_aNativeTempURL.isEmpty() ) { KillFile_Impl( m_aNativeTempURL, m_xFactory ); m_aNativeTempURL = ::rtl::OUString(); @@ -470,7 +470,7 @@ void OwnView_Impl::CreateNative() { bOk = ReadContentsAndGenerateTempFile( xSubStream->getInputStream(), sal_False ); - if ( !bOk && m_aNativeTempURL.getLength() ) + if ( !bOk && !m_aNativeTempURL.isEmpty() ) { KillFile_Impl( m_aNativeTempURL, m_xFactory ); m_aNativeTempURL = ::rtl::OUString(); @@ -532,13 +532,13 @@ sal_Bool OwnView_Impl::Open() if ( !bResult && !m_bUseNative ) { // the original storage can not be recognized - if ( !m_aNativeTempURL.getLength() ) + if ( m_aNativeTempURL.isEmpty() ) { // create a temporary file for the native representation if there is no CreateNative(); } - if ( m_aNativeTempURL.getLength() ) + if ( !m_aNativeTempURL.isEmpty() ) { bResult = CreateModel( sal_True ); if ( bResult ) diff --git a/embeddedobj/source/msole/xolefactory.cxx b/embeddedobj/source/msole/xolefactory.cxx index 1257048222d7..8fac58e32012 100644 --- a/embeddedobj/source/msole/xolefactory.cxx +++ b/embeddedobj/source/msole/xolefactory.cxx @@ -85,7 +85,7 @@ uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); @@ -157,7 +157,7 @@ uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); @@ -199,7 +199,7 @@ uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 3 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 4 ); @@ -241,7 +241,7 @@ uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInsta static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), @@ -287,7 +287,7 @@ uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInsta uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 1 ); - if ( !sEntName.getLength() ) + if ( sEntName.isEmpty() ) throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )), uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ), 2 ); -- cgit