[Libreoffice-commits] .: 2 commits - basic/source framework/source

Caolán McNamara caolan at kemper.freedesktop.org
Sun Oct 24 13:06:35 PDT 2010


 basic/source/classes/eventatt.cxx                              |  100 ++++------
 framework/source/inc/accelerators/acceleratorconfiguration.hxx |   10 -
 2 files changed, 53 insertions(+), 57 deletions(-)

New commits:
commit b92cc3078f3b7ccde061e25b587cc7230a41da0f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Oct 24 21:02:46 2010 +0100

    micro opts

diff --git a/framework/source/inc/accelerators/acceleratorconfiguration.hxx b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
index 8fa0902..12dec51 100644
--- a/framework/source/inc/accelerators/acceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
@@ -75,13 +75,13 @@ namespace framework
 //-----------------------------------------------
 // Accelerators.xcu
 
-static const ::rtl::OUString CFG_ENTRY_PRIMARY	    = ::rtl::OUString::createFromAscii("PrimaryKeys");
-static const ::rtl::OUString CFG_ENTRY_SECONDARY	= ::rtl::OUString::createFromAscii("SecondaryKeys");
+static const ::rtl::OUString CFG_ENTRY_PRIMARY(RTL_CONSTASCII_USTRINGPARAM("PrimaryKeys"));
+static const ::rtl::OUString CFG_ENTRY_SECONDARY(RTL_CONSTASCII_USTRINGPARAM("SecondaryKeys"));
 
-static const ::rtl::OUString CFG_ENTRY_GLOBAL	    = ::rtl::OUString::createFromAscii("Global");
-static const ::rtl::OUString CFG_ENTRY_MODULES      = ::rtl::OUString::createFromAscii("Modules");
+static const ::rtl::OUString CFG_ENTRY_GLOBAL(RTL_CONSTASCII_USTRINGPARAM("Global"));
+static const ::rtl::OUString CFG_ENTRY_MODULES(RTL_CONSTASCII_USTRINGPARAM("Modules"));
 
-static const ::rtl::OUString CFG_PROP_COMMAND       = ::rtl::OUString::createFromAscii("Command");
+static const ::rtl::OUString CFG_PROP_COMMAND(RTL_CONSTASCII_USTRINGPARAM("Command"));
 
 /** "global" type to make accelerator presets unique, so they can be used
     in combination with the salhelper::SingletonRef mechanism! */
commit 770116070994cca4b5ccac1931edbcded883bbda
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Oct 24 20:28:48 2010 +0100

    micro opts and fix indentation

diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index fed75f2..08714e3 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -156,18 +156,18 @@ void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Refere
                 Reference< XComponentContext > xContext;
                 Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
                 OSL_ASSERT( xProps.is() );
-                OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString::createFromAscii( "DefaultContext" ) ) >>= xContext );
+                OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
                 if ( xContext.is() )
                 {
                     Reference< provider::XScriptProviderFactory > xFactory(
                         xContext->getValueByName(
-                        ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory" ) ),
+                        ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory")) ),
                         UNO_QUERY );
                     OSL_ENSURE( xFactory.is(), "SFURL_firing_impl: failed to get master script provider factory" );
                     if ( xFactory.is() )
                     {
                         Any aCtx;
-                        aCtx <<= ::rtl::OUString::createFromAscii( "user" );
+                        aCtx <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user"));
                         xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY );
                     }
                 }
@@ -486,15 +486,8 @@ Any implFindDialogLibForDialogBasic( const Any& aAnyISP, SbxObject* pBasic, Star
     return aDlgLibAny;
 }
 
-static ::rtl::OUString aDecorationPropName =
-    ::rtl::OUString::createFromAscii( "Decoration" );
-static ::rtl::OUString aTitlePropName =
-    ::rtl::OUString::createFromAscii( "Title" );
-
 void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
 {
-    static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAscii( "ResourceResolver" );
-
     (void)pBasic;
     (void)bWrite;
 
@@ -553,11 +546,14 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
         bool bDecoration = true;
         try
         {
+            ::rtl::OUString aDecorationPropName(RTL_CONSTASCII_USTRINGPARAM("Decoration"));
             Any aDecorationAny = xDlgModPropSet->getPropertyValue( aDecorationPropName );
             aDecorationAny >>= bDecoration;
             if( !bDecoration )
             {
                 xDlgModPropSet->setPropertyValue( aDecorationPropName, makeAny( true ) );
+
+                ::rtl::OUString aTitlePropName(RTL_CONSTASCII_USTRINGPARAM("Title"));
                 xDlgModPropSet->setPropertyValue( aTitlePropName, makeAny( ::rtl::OUString() ) );
             }
         }
@@ -570,43 +566,43 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
     StarBASIC* pFoundBasic = NULL;
     OSL_TRACE("About to try get a hold of ThisComponent");
     Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ;
-        aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
-        // If we found the dialog then it belongs to the Search basic
-        if ( !pFoundBasic )
-    {
-            Reference< frame::XDesktop > xDesktop( xMSF->createInstance
-        ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
-            UNO_QUERY );
-            Reference< container::XEnumeration > xModels;
-            if ( xDesktop.is() )
+    aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
+    // If we found the dialog then it belongs to the Search basic
+    if ( !pFoundBasic )
     {
-                Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY );
-                if ( xComponents.is() )
-                    xModels.set( xComponents->createEnumeration(), UNO_QUERY );
-                if ( xModels.is() )
+        Reference< frame::XDesktop > xDesktop( xMSF->createInstance
+    ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
+        UNO_QUERY );
+        Reference< container::XEnumeration > xModels;
+        if ( xDesktop.is() )
+        {
+            Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY );
+            if ( xComponents.is() )
+                xModels.set( xComponents->createEnumeration(), UNO_QUERY );
+            if ( xModels.is() )
+            {
+                while ( xModels->hasMoreElements() )
                 {
-                    while ( xModels->hasMoreElements() )
+                    Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY );
+                    if ( xNextModel.is() )
                     {
-                        Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY );
-                        if ( xNextModel.is() )
+                        BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel );
+                        if ( pMgr )
+                            aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic );
+                        if ( aDlgLibAny.hasValue() )
                         {
-                            BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel );	
-                            if ( pMgr )
-                                aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic );
-                            if ( aDlgLibAny.hasValue() )
-    {
-                                bDocDialog = true;
-                                xModel = xNextModel;
-                                break;
-    }
+                            bDocDialog = true;
+                            xModel = xNextModel;
+                            break;
                         }
                     }
                 }
             }
         }
+    }
     if ( pFoundBasic )
         bDocDialog = pFoundBasic->IsDocBasic();
-       Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), xModel );
+    Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), xModel );
 
     Sequence< Any > aArgs( 4 );
     if( bDocDialog )
@@ -617,23 +613,23 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
     aArgs[ 2 ] = aDlgLibAny;
     aArgs[ 3 ] <<= xScriptListener;
     // Create a "living" Dialog
-        Reference< XControl > xCntrl;
-        try
-        {
+    Reference< XControl > xCntrl;
+    try
+    {
         Reference< XDialogProvider >  xDlgProv( xMSF->createInstanceWithArguments( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.scripting.DialogProvider" ) ), aArgs ), UNO_QUERY );
-            xCntrl.set( xDlgProv->createDialog( rtl::OUString() ), UNO_QUERY_THROW );
-           // Add dialog model to dispose vector
-           Reference< XComponent > xDlgComponent( xCntrl->getModel(), UNO_QUERY );
-           pINST->getComponentVector().push_back( xDlgComponent );
-           // need ThisCompoent from calling script
-        }
-        // preserve existing bad behaviour, it's possible... but probably
-        // illegal to open 2 dialogs ( they ARE modal ) when this happens, sometimes
-        // create dialog fails.  So, in this case let's not throw, just leave basic
-        // detect the unset object.
-        catch( uno::Exception& )
-        {
-        }
+        xCntrl.set( xDlgProv->createDialog( rtl::OUString() ), UNO_QUERY_THROW );
+       // Add dialog model to dispose vector
+       Reference< XComponent > xDlgComponent( xCntrl->getModel(), UNO_QUERY );
+       pINST->getComponentVector().push_back( xDlgComponent );
+       // need ThisCompoent from calling script
+    }
+    // preserve existing bad behaviour, it's possible... but probably
+    // illegal to open 2 dialogs ( they ARE modal ) when this happens, sometimes
+    // create dialog fails.  So, in this case let's not throw, just leave basic
+    // detect the unset object.
+    catch( uno::Exception& )
+    {
+    }
 
     // Return dialog
     Any aRetVal;


More information about the Libreoffice-commits mailing list