[Libreoffice-commits] .: vbahelper/source

Olivier Hallot ohallot at kemper.freedesktop.org
Sat Jan 28 06:00:30 PST 2012


 vbahelper/source/msforms/vbacombobox.cxx           |    4 ++--
 vbahelper/source/msforms/vbacontrols.cxx           |   12 ++++++------
 vbahelper/source/msforms/vbalistcontrolhelper.cxx  |    2 +-
 vbahelper/source/msforms/vbauserform.cxx           |    2 +-
 vbahelper/source/vbahelper/vbaapplicationbase.cxx  |    4 ++--
 vbahelper/source/vbahelper/vbacommandbar.cxx       |    2 +-
 vbahelper/source/vbahelper/vbacommandbarhelper.cxx |    4 ++--
 vbahelper/source/vbahelper/vbacommandbars.cxx      |    8 ++++----
 vbahelper/source/vbahelper/vbadialogbase.cxx       |    2 +-
 vbahelper/source/vbahelper/vbadocumentbase.cxx     |    4 ++--
 vbahelper/source/vbahelper/vbaeventshelperbase.cxx |   12 ++++++------
 vbahelper/source/vbahelper/vbahelper.cxx           |    4 ++--
 12 files changed, 30 insertions(+), 30 deletions(-)

New commits:
commit 7f585002c460a095693eeec4453b869b3915118b
Author: Olivier Hallot <olivier.hallot at alta.org.br>
Date:   Sat Jan 28 11:59:23 2012 -0200

    Fix for fdo43460 Part LVI getLength() to isEmpty()
    
    Part LVI
    Modules
    vbahelper

diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx
index 6f5049c..d9e9527 100644
--- a/vbahelper/source/msforms/vbacombobox.cxx
+++ b/vbahelper/source/msforms/vbacombobox.cxx
@@ -62,7 +62,7 @@ ScVbaComboBox::ScVbaComboBox( const uno::Reference< XHelperInterface >& xParent,
     catch( uno::Exception& )
     {
     }
-    if( sSourceName.getLength() == 0 )
+    if( sSourceName.isEmpty() )
         sSourceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) );
 }
 
@@ -110,7 +110,7 @@ ScVbaComboBox::getListIndex() throw (uno::RuntimeException)
     {
         rtl::OUString sText = getText();
         sal_Int32 nLen = sItems.getLength();
-        for ( sal_Int32 index = 0; sText.getLength() && index < nLen; ++index )
+        for ( sal_Int32 index = 0; !sText.isEmpty() && index < nLen; ++index )
         {
             if ( sItems[ index ].equals( sText ) )
             {
diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx
index 53706cf..c62cb5a 100644
--- a/vbahelper/source/msforms/vbacontrols.cxx
+++ b/vbahelper/source/msforms/vbacontrols.cxx
@@ -288,10 +288,10 @@ uno::Any SAL_CALL ScVbaControls::Add( const uno::Any& Object, const uno::Any& St
         // TODO: Support Before and After?
         ::rtl::OUString aNewName;
         StringKey >>= aNewName;
-        if ( !aNewName.getLength() )
+        if ( aNewName.isEmpty() )
         {
             aNewName = aComServiceName;
-            if ( !aNewName.getLength() )
+            if ( aNewName.isEmpty() )
                 aNewName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Control" ) );
 
             sal_Int32 nInd = 0;
@@ -303,7 +303,7 @@ uno::Any SAL_CALL ScVbaControls::Add( const uno::Any& Object, const uno::Any& St
         }
 
         double fDefWidth = 72.0, fDefHeight = 18.0;
-        if ( aComServiceName.getLength() )
+        if ( !aComServiceName.isEmpty() )
         {
             // create a UNO control model based on the passed control type
             uno::Reference< awt::XControlModel > xNewModel;
@@ -464,12 +464,12 @@ void SAL_CALL ScVbaControls::Remove( const uno::Any& StringKeyOrIndex )
         uno::Reference< lang::XMultiServiceFactory > xModelFactory( mxDialog->getModel(), uno::UNO_QUERY_THROW );
         uno::Reference< container::XNameContainer > xDialogContainer( xModelFactory, uno::UNO_QUERY_THROW );
 
-        if ( !( ( StringKeyOrIndex >>= aControlName ) && aControlName.getLength() )
+        if ( !( ( StringKeyOrIndex >>= aControlName ) && !aControlName.isEmpty() )
           && !( ( StringKeyOrIndex >>= nIndex ) && nIndex >= 0 && nIndex < m_xIndexAccess->getCount() ) )
             throw uno::RuntimeException();
 
         uno::Reference< awt::XControl > xControl;
-        if ( aControlName.getLength() )
+        if ( !aControlName.isEmpty() )
         {
             uno::Reference< awt::XControlContainer > xControlContainer( mxDialog, uno::UNO_QUERY_THROW );
             xControl = xControlContainer->getControl( aControlName );
@@ -482,7 +482,7 @@ void SAL_CALL ScVbaControls::Remove( const uno::Any& StringKeyOrIndex )
         if ( !xControl.is() )
             throw uno::RuntimeException();
 
-        if ( !aControlName.getLength() )
+        if ( aControlName.isEmpty() )
             aControlName = ControlArrayWrapper::getControlName( xControl );
 
         xDialogContainer->removeByName( aControlName );
diff --git a/vbahelper/source/msforms/vbalistcontrolhelper.cxx b/vbahelper/source/msforms/vbalistcontrolhelper.cxx
index 828c766..8186d3d 100644
--- a/vbahelper/source/msforms/vbalistcontrolhelper.cxx
+++ b/vbahelper/source/msforms/vbalistcontrolhelper.cxx
@@ -161,7 +161,7 @@ ListControlHelper::Clear(  ) throw (uno::RuntimeException)
 void SAL_CALL
 ListControlHelper::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
 {
-    if ( _rowsource.getLength() == 0 )
+    if ( _rowsource.isEmpty() )
         Clear();
 }
 
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 2800403..fdbecef 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -273,7 +273,7 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un
         {
             uno::Reference< msforms::XControl > xVBAControl = ScVbaControlFactory::createUserformControl( mxContext, xControl, xDialogControl, m_xModel, mpGeometryHelper->getOffsetX(), mpGeometryHelper->getOffsetY() );
             ScVbaControl* pControl  = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
-            if ( m_sLibName.getLength() )
+            if ( !m_sLibName.isEmpty() )
                 pControl->setLibraryAndCodeName( m_sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( getName() ) );
             aResult = uno::makeAny( xVBAControl );
         }
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index 162ea28..e800a90 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -109,7 +109,7 @@ public:
 
     void Start( const ::rtl::Reference< VbaApplicationBase > xBase, const ::rtl::OUString& aFunction, double nFrom, double nTo )
     {
-        if ( !xBase.is() || !aFunction.getLength() )
+        if ( !xBase.is() || aFunction.isEmpty() )
             throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected arguments!" ) ), uno::Reference< uno::XInterface >() );
 
         m_xBase = xBase;
@@ -347,7 +347,7 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, con
 void SAL_CALL VbaApplicationBase::OnTime( const uno::Any& aEarliestTime, const ::rtl::OUString& aFunction, const uno::Any& aLatestTime, const uno::Any& aSchedule )
     throw ( uno::RuntimeException )
 {
-    if ( !aFunction.getLength() )
+    if ( aFunction.isEmpty() )
         throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected function name!" ) ), uno::Reference< uno::XInterface >() );
 
     double nEarliestTime = 0;
diff --git a/vbahelper/source/vbahelper/vbacommandbar.cxx b/vbahelper/source/vbahelper/vbacommandbar.cxx
index bf790b3..404c63b 100644
--- a/vbahelper/source/vbahelper/vbacommandbar.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbar.cxx
@@ -50,7 +50,7 @@ ScVbaCommandBar::getName() throw ( uno::RuntimeException )
     uno::Any aName = xPropertySet->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIName")) );
     rtl::OUString sName;
     aName >>= sName;
-    if( sName.getLength() < 1 )
+    if( sName.isEmpty() )
     {
         if( m_bIsMenu )
         {
diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
index 9cf3522..6223ee0 100644
--- a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
@@ -114,7 +114,7 @@ void VbaCommandBarHelper::Init( ) throw (css::uno::RuntimeException)
         maModuleId = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument") );
     }
 
-    if( maModuleId.getLength() == 0 )
+    if( maModuleId.isEmpty() )
     {
         throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
     }
@@ -209,7 +209,7 @@ rtl::OUString VbaCommandBarHelper::findToolbarByName( const css::uno::Reference<
 
     // check if it is an buildin toolbar
     sResourceUrl = MSO2OOCommandbarHelper::getMSO2OOCommandbarHelper()->findBuildinToolbar( sName );
-    if( sResourceUrl.getLength() > 0 )
+    if( !sResourceUrl.isEmpty() )
         return sResourceUrl;
 
     uno::Sequence< ::rtl::OUString > allNames = xNameAccess->getElementNames();
diff --git a/vbahelper/source/vbahelper/vbacommandbars.cxx b/vbahelper/source/vbahelper/vbacommandbars.cxx
index 0e02107..ae8be28 100644
--- a/vbahelper/source/vbahelper/vbacommandbars.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbars.cxx
@@ -143,14 +143,14 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
         }
 
         // nothing found - try to resolve from name
-        if( !aRet.hasValue() && (sResourceUrl.getLength() == 0) )
+        if( !aRet.hasValue() && sResourceUrl.isEmpty() )
         {
             sResourceUrl = m_pCBarHelper->findToolbarByName( m_xNameAccess, sBarName );
             bMenu = sal_False;
         }
     }
 
-    if( sResourceUrl.getLength() )
+    if( !sResourceUrl.isEmpty() )
     {
         xBarSettings = m_pCBarHelper->getSettings( sResourceUrl );
         aRet <<= uno::Reference< XCommandBar >( new ScVbaCommandBar( this, mxContext, m_pCBarHelper, xBarSettings, sResourceUrl, bMenu, sal_False ) );
@@ -174,10 +174,10 @@ ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Positio
         Name >>= sName;
 
     rtl::OUString sResourceUrl;
-    if( sName.getLength() )
+    if( !sName.isEmpty() )
     {
         sResourceUrl = m_pCBarHelper->findToolbarByName( m_xNameAccess, sName );
-        if( sResourceUrl.getLength() )
+        if( !sResourceUrl.isEmpty() )
             throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toolbar exists") ), uno::Reference< uno::XInterface >() );
     }
     else
diff --git a/vbahelper/source/vbahelper/vbadialogbase.cxx b/vbahelper/source/vbahelper/vbadialogbase.cxx
index 86de3e7..fd380bc 100644
--- a/vbahelper/source/vbahelper/vbadialogbase.cxx
+++ b/vbahelper/source/vbahelper/vbadialogbase.cxx
@@ -38,7 +38,7 @@ sal_Bool SAL_CALL VbaDialogBase::Show() throw ( uno::RuntimeException )
     if ( m_xModel.is() )
     {
         aURL = mapIndexToName( mnIndex );
-        if( aURL.getLength() == 0  )
+        if( aURL.isEmpty() )
             throw uno::RuntimeException(
                 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ),
                 uno::Reference< XInterface > () );
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx
index 156d386..7976423 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -67,7 +67,7 @@ VbaDocumentBase::VbaDocumentBase( uno::Sequence< uno::Any> const & args,
 VbaDocumentBase::getName() throw (uno::RuntimeException)
 {
     rtl::OUString sName = getModel()->getURL();
-    if ( sName.getLength() )
+    if ( !sName.isEmpty() )
     {
 
         INetURLObject aURL( getModel()->getURL() );
@@ -87,7 +87,7 @@ VbaDocumentBase::getPath() throw (uno::RuntimeException)
     INetURLObject aURL( getModel()->getURL() );
     rtl::OUString sURL = aURL.GetMainURL( INetURLObject::DECODE_TO_IURI );
     rtl::OUString sPath;
-    if( sURL.getLength() > 0 )
+    if( !sURL.isEmpty() )
     {
        sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() - 1 );
        ::osl::File::getSystemPathFromFileURL( sURL, sPath );
diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
index 57e535a..6f1888c 100644
--- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
+++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
@@ -69,7 +69,7 @@ sal_Bool SAL_CALL VbaEventsHelperBase::hasVbaEventHandler( sal_Int32 nEventId, c
     // getEventHandlerInfo() throws, if unknown event dentifier has been passed
     const EventHandlerInfo& rInfo = getEventHandlerInfo( nEventId );
     // getEventHandlerPath() searches for the macro in the document
-    return getEventHandlerPath( rInfo, rArgs ).getLength() > 0;
+    return !getEventHandlerPath( rInfo, rArgs ).isEmpty();
 }
 
 sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
@@ -114,7 +114,7 @@ sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, cons
         {
             // search the event handler macro in the document
             OUString aMacroPath = getEventHandlerPath( rInfo, aEventArgs );
-            if( aMacroPath.getLength() > 0 )
+            if( !aMacroPath.isEmpty() )
             {
                 // build the argument list
                 uno::Sequence< uno::Any > aVbaArgs = implBuildArgumentList( rInfo, aEventArgs );
@@ -179,7 +179,7 @@ void SAL_CALL VbaEventsHelperBase::changesOccurred( const util::ChangesEvent& rE
     {
         const util::ElementChange& rChange = rEvent.Changes[ nIndex ];
         OUString aModuleName;
-        if( (rChange.Accessor >>= aModuleName) && (aModuleName.getLength() > 0) ) try
+        if( (rChange.Accessor >>= aModuleName) && !aModuleName.isEmpty() ) try
         {
             // invalidate event handler path map depending on module type
             if( getModuleType( aModuleName ) == script::ModuleType::NORMAL )
@@ -275,7 +275,7 @@ OUString VbaEventsHelperBase::getEventHandlerPath( const EventHandlerInfo& rInfo
         // document event: get name of the code module associated to the event sender
         case script::ModuleType::DOCUMENT:
             aModuleName = implGetDocumentModuleName( rInfo, rArgs );
-            if( aModuleName.getLength() == 0 )
+            if( aModuleName.isEmpty() )
                 throw lang::IllegalArgumentException();
         break;
 
@@ -295,7 +295,7 @@ void VbaEventsHelperBase::ensureVBALibrary() throw (uno::RuntimeException)
     if( !mxModuleInfos.is() ) try
     {
         maLibraryName = getDefaultProjectName( mpShell );
-        if( maLibraryName.getLength() == 0 )
+        if( maLibraryName.isEmpty() )
             throw uno::RuntimeException();
         uno::Reference< beans::XPropertySet > xModelProps( mxModel, uno::UNO_QUERY_THROW );
         uno::Reference< container::XNameAccess > xBasicLibs( xModelProps->getPropertyValue(
@@ -319,7 +319,7 @@ sal_Int32 VbaEventsHelperBase::getModuleType( const OUString& rModuleName ) thro
     ensureVBALibrary();
 
     // no module specified: global event handler in standard code modules
-    if( rModuleName.getLength() == 0 )
+    if( rModuleName.isEmpty() )
         return script::ModuleType::NORMAL;
 
     // get module type from module info
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index f8e1cfe..f99077d 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -432,13 +432,13 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::
         aArgs.Put( sfxCollate, sfxCollate.Which() );
         SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies );
         aArgs.Put( sfxCopies, sfxCopies.Which() );
-        if ( sFileName.getLength() )
+        if ( !sFileName.isEmpty() )
         {
             SfxStringItem sfxFileName( SID_FILE_NAME, sFileName);
             aArgs.Put( sfxFileName, sfxFileName.Which() );
 
         }
-        if (  sRange.getLength() )
+        if (  !sRange.isEmpty() )
         {
             SfxStringItem sfxRange( SID_PRINT_PAGES, sRange );
             aArgs.Put( sfxRange, sfxRange.Which() );


More information about the Libreoffice-commits mailing list