From 81e50fb2e378120d05f7ffdee216ce6e248e189b Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Mon, 16 Jan 2012 15:46:57 -0200 Subject: Fix for fdo43460 Part XXXIX getLength() to isEmpty() Part XXXIX Modules testtools, toolkit, tools --- toolkit/source/awt/vclxtoolkit.cxx | 4 ++-- toolkit/source/awt/vclxwindow.cxx | 2 +- toolkit/source/awt/vclxwindows.cxx | 8 ++++---- toolkit/source/controls/controlmodelcontainerbase.cxx | 8 ++++---- toolkit/source/controls/dialogcontrol.cxx | 12 ++++++------ toolkit/source/controls/geometrycontrolmodel.cxx | 2 +- toolkit/source/controls/unocontrol.cxx | 2 +- toolkit/source/controls/unocontrolmodel.cxx | 8 ++++---- toolkit/source/controls/unocontrols.cxx | 2 +- toolkit/source/helper/formpdfexport.cxx | 2 +- toolkit/source/helper/tkresmgr.cxx | 2 +- toolkit/source/helper/vclunohelper.cxx | 4 ++-- 12 files changed, 28 insertions(+), 28 deletions(-) (limited to 'toolkit') diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index b9d94be3ec1b..3a8e2c625182 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -366,7 +366,7 @@ sal_uInt16 ImplGetComponentType( const String& rServiceName ) ComponentInfo aSearch; rtl::OString aServiceName(rtl::OUStringToOString(rServiceName, osl_getThreadTextEncoding()).toAsciiLowerCase()); - if ( aServiceName.getLength() ) + if ( !aServiceName.isEmpty() ) aSearch.pName = aServiceName.getStr(); else aSearch.pName = "window"; @@ -1353,7 +1353,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > SAL_CALL VCLXToolkit::getClipboard( const ::rtl::OUString& clipboardName ) throw(::com::sun::star::uno::RuntimeException) { - if( clipboardName.getLength() == 0 ) + if( clipboardName.isEmpty() ) { if( !mxClipboard.is() ) { diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 76eab5bf0e37..7f2af75002f5 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -1545,7 +1545,7 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: case WINDOW_CANCELBUTTON: case WINDOW_HELPBUTTON: // Standard Button: overwrite only if not empty. - if (aText.getLength()) + if (!aText.isEmpty()) pWindow->SetText( aText ); break; diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 2669f0f21dce..f85bc3ce8da4 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -2067,7 +2067,7 @@ namespace { Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL ) { - if ( !i_rImageURL.getLength() ) + if ( i_rImageURL.isEmpty() ) return Image(); try @@ -2174,7 +2174,7 @@ void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent ) throw for ( sal_Int32 i=0; iresolveString(aLocalizationKey.copy( 1 )); } @@ -2973,7 +2973,7 @@ void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute( ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.system.SystemShellExecute"))), uno::UNO_QUERY ); - if ( sURL.getLength() > 0 && xSystemShellExecute.is() ) + if ( !sURL.isEmpty() && xSystemShellExecute.is() ) { try { @@ -4680,7 +4680,7 @@ void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent ) throw for ( sal_Int32 i=0; iresolveString(aLocalizationKey.copy( 1 )); } diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index a227d61014cd..e717055747d3 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -595,7 +595,7 @@ void ControlModelContainerBase::insertByName( const ::rtl::OUString& aName, cons - if ( !aName.getLength() || !xM.is() ) + if ( aName.isEmpty() || !xM.is() ) lcl_throwIllegalArgumentException(); UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName ); @@ -1454,7 +1454,7 @@ void ControlContainerBase::ImplSetPosSize( Reference< XControl >& rxCtrl ) FontDescriptor aFD; Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) ); aVal >>= aFD; - if ( aFD.StyleName.getLength() ) + if ( !aFD.StyleName.isEmpty() ) { Reference< XFont > xFont = xD->getFont( aFD ); aFM = xFont->getFontMetric(); @@ -1860,7 +1860,7 @@ void ControlContainerBase::ImplUpdateResourceResolver() uno::Reference< graphic::XGraphic > ControlContainerBase::Impl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ) { uno::Reference< graphic::XGraphic > xGraphic; - if ( !_rURL.getLength() ) + if ( _rURL.isEmpty() ) return xGraphic; try @@ -1895,7 +1895,7 @@ uno::Reference< graphic::XGraphic > ControlContainerBase::Impl_getGraphicFromURL rUrl >>= url; ::rtl::OUString absoluteURL( url ); - if ( url.getLength() > 0 ) + if ( !url.isEmpty() ) { INetURLObject urlObj(baseLocation); urlObj.removeSegment(); diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index f152ff74823e..5a1303d84d25 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -336,7 +336,7 @@ void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDes ::rtl::OUString aImageURL; Reference< graphic::XGraphic > xGraphic; if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) && - ( aImageURL.getLength() > 0 )) + ( !aImageURL.isEmpty() )) { ::rtl::OUString absoluteUrl = getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ), @@ -564,7 +564,7 @@ void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChang ::rtl::OUString aImageURL; Reference< graphic::XGraphic > xGraphic; if (( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ) ) >>= aImageURL ) && - ( aImageURL.getLength() > 0 )) + ( !aImageURL.isEmpty() )) { ::rtl::OUString absoluteUrl = getPhysicalLocation( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL )), @@ -1018,7 +1018,7 @@ void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl ) ControlContainerBase::ImplSetPosSize( rxCtrl ); Reference < XWindow > xW( rxCtrl, UNO_QUERY ); - if ( !bOwnCtrl && xW.is() && sTitle.getLength() ) + if ( !bOwnCtrl && xW.is() && !sTitle.isEmpty() ) { awt::Rectangle aSizePos = xW->getPosSize(); @@ -1027,7 +1027,7 @@ void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl ) OutputDevice*pOutDev = Application::GetDefaultDevice(); if ( pOutDev ) { - if ( !bOwnCtrl && sTitle.getLength() ) + if ( !bOwnCtrl && !sTitle.isEmpty() ) { // Adjust Y based on height of Title ::Rectangle aRect; @@ -1044,7 +1044,7 @@ void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl ) FontDescriptor aFD; Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) ); aVal >>= aFD; - if ( aFD.StyleName.getLength() ) + if ( !aFD.StyleName.isEmpty() ) { Reference< XFont > xFont = xD->getFont( aFD ); aFM = xFont->getFontMetric(); @@ -1056,7 +1056,7 @@ void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl ) } sal_Int16 nH = aFM.Ascent + aFM.Descent; - if ( !bOwnCtrl && sTitle.getLength() ) + if ( !bOwnCtrl && !sTitle.isEmpty() ) // offset y based on height of font ( not sure if my guess at the correct calculation is correct here ) nY = nY + ( nH / 8); // how do I test this } diff --git a/toolkit/source/controls/geometrycontrolmodel.cxx b/toolkit/source/controls/geometrycontrolmodel.cxx index 9f6dd3eb21e5..82b1dd746996 100644 --- a/toolkit/source/controls/geometrycontrolmodel.cxx +++ b/toolkit/source/controls/geometrycontrolmodel.cxx @@ -635,7 +635,7 @@ sal_Int16 nAttributes(0); static_cast< OPropertyArrayAggregationHelper* >( getArrayHelper( m_nPropertyMapId ) )->fillPropertyMembersByHandle( &sPropName, &nAttributes, _nHandle ); - if ( m_xAggregateSet.is() && sPropName.getLength() ) + if ( m_xAggregateSet.is() && !sPropName.isEmpty() ) m_xAggregateSet->setPropertyValue( sPropName, _rValue ); } } diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 98e6392fe72e..b845b5984714 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -258,7 +258,7 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptE bool UnoControl::ImplCheckLocalize( ::rtl::OUString& _rPossiblyLocalizable ) { if ( !mpData->bLocalizationSupport - || ( _rPossiblyLocalizable.getLength() == 0 ) + || ( _rPossiblyLocalizable.isEmpty() ) || ( _rPossiblyLocalizable[0] != '&' ) // TODO: make this reasonable. At the moment, everything which by accident starts with a & is considered // localizable, which is probably wrong. diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 9c731d2edcdb..e00e791935bd 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -409,7 +409,7 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const } LocaleDataWrapper aLocaleInfo( maContext.getLegacyServiceFactory(), aLocale ); - if ( !sBankSymbol.getLength() ) + if ( sBankSymbol.isEmpty() ) sBankSymbol = aLocaleInfo.getCurrBankSymbol(); // look for the currency entry (for this language) which has the given bank symbol @@ -418,7 +418,7 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const const Currency2* pAllCurrenciesEnd = pAllCurrencies + aAllCurrencies.getLength(); ::rtl::OUString sCurrencySymbol = aLocaleInfo.getCurrSymbol(); - if ( !sBankSymbol.getLength() ) + if ( sBankSymbol.isEmpty() ) { DBG_ASSERT( pAllCurrencies != pAllCurrenciesEnd, "UnoControlModel::ImplGetDefaultValue: no currencies at all!" ); if ( pAllCurrencies != pAllCurrenciesEnd ) @@ -428,7 +428,7 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const } } - if ( sBankSymbol.getLength() ) + if ( !sBankSymbol.isEmpty() ) { bool bLegacy = false; for ( ;pAllCurrencies != pAllCurrenciesEnd; ++pAllCurrencies ) @@ -1048,7 +1048,7 @@ void UnoControlModel::read( const ::com::sun::star::uno::Reference< ::com::sun:: { for ( i = 0; i < (sal_uInt32)aProps.getLength(); i++ ) { - if ( !aProps.getConstArray()[i].getLength() ) + if ( aProps.getConstArray()[i].isEmpty() ) { ::comphelper::removeElementAt( aProps, i ); ::comphelper::removeElementAt( aValues, i ); diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index 2fae9e6fa4d8..b193da5b0859 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -553,7 +553,7 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const else // linked mxGrfObj = NULL; // release the GraphicObject - if ( !_rURL.getLength() ) + if ( _rURL.isEmpty() ) return xGraphic; try diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx index cedc4825c7e4..957c0186620b 100644 --- a/toolkit/source/helper/formpdfexport.cxx +++ b/toolkit/source/helper/formpdfexport.cxx @@ -495,7 +495,7 @@ namespace toolkitform { ::rtl::OUString sURL; OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= sURL ); - const bool bDocumentLocalTarget = ( sURL.getLength() > 0 ) && ( sURL.getStr()[0] == '#' ); + const bool bDocumentLocalTarget = !sURL.isEmpty() && ( sURL.getStr()[0] == '#' ); if ( bDocumentLocalTarget ) { const ::rtl::OUString sDestinationName( sURL.copy(1) ); diff --git a/toolkit/source/helper/tkresmgr.cxx b/toolkit/source/helper/tkresmgr.cxx index 7bf8b028c5dd..ed29c38dce44 100644 --- a/toolkit/source/helper/tkresmgr.cxx +++ b/toolkit/source/helper/tkresmgr.cxx @@ -104,7 +104,7 @@ Image TkResMgr::loadImage( sal_uInt16 nResId ) // ----------------------------------------------------------------------------- Image TkResMgr::getImageFromURL( const ::rtl::OUString& i_rImageURL ) { - if ( !i_rImageURL.getLength() ) + if ( i_rImageURL.isEmpty() ) return Image(); try diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index 888926e87143..4a38bf82a325 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -355,9 +355,9 @@ FontWeight VCLUnoHelper::ConvertFontWeight( float f ) Font VCLUnoHelper::CreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr, const Font& rInitFont ) { Font aFont( rInitFont ); - if ( rDescr.Name.getLength() ) + if ( !rDescr.Name.isEmpty() ) aFont.SetName( rDescr.Name ); - if ( rDescr.StyleName.getLength() ) + if ( !rDescr.StyleName.isEmpty() ) aFont.SetStyleName( rDescr.StyleName ); if ( rDescr.Height ) aFont.SetSize( Size( rDescr.Width, rDescr.Height ) ); -- cgit