[Libreoffice-commits] .: desktop/inc desktop/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Jan 19 08:27:45 PST 2011


 desktop/inc/app.hxx                |    4 +---
 desktop/source/app/app.cxx         |   19 +++++--------------
 desktop/source/app/sofficemain.cxx |    2 +-
 3 files changed, 7 insertions(+), 18 deletions(-)

New commits:
commit 7f69d20d16cdc5eac582081c9956c836b06249a1
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Jan 19 11:15:15 2011 -0500

    Create process service factory early in all platforms.
    
    Just so that we can remove one #ifdef UNX guard. The less of those
    the easier to maintain.

diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 14aff69..a9ff1b5 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -137,9 +137,7 @@ class Desktop : public Application
         void                    SetSplashScreenText( const ::rtl::OUString& rText );
         void                    SetSplashScreenProgress( sal_Int32 );
 
-#ifdef UNX
-        void EarlyCommandLineArgsPrepare();
-#endif
+        void                    CreateProcessServiceFactory();
 
     private:
         // Bootstrap methods
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index d41df1c..1ae2d2f 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -670,18 +670,11 @@ void Desktop::Init()
         }
     }
     
-    // create service factory...
-    if( !::comphelper::getProcessServiceFactory().is()) // may be set from Desktop::EarlyCommandLineArgsPrepare()
+    // We need to have service factory before going further.
+    if( !::comphelper::getProcessServiceFactory().is())
     {
-        Reference < XMultiServiceFactory > rSMgr = CreateApplicationServiceManager();
-        if( rSMgr.is() )
-        {
-            ::comphelper::setProcessServiceFactory( rSMgr );
-        }
-        else
-        {
-            SetBootstrapError( BE_UNO_SERVICEMANAGER );
-        }
+        OSL_ENSURE(0, "Service factory should have been crated in soffice_main().");
+        SetBootstrapError( BE_UNO_SERVICEMANAGER );
     }
 
     if ( GetBootstrapError() == BE_OK )
@@ -727,10 +720,9 @@ void Desktop::InitFinished()
     CloseSplashScreen();
 }
 
-#ifdef UNX
 // GetCommandLineArgs() requires this code to work, otherwise it will abort, and
 // on Unix command line args needs to be checked before Desktop::Init()
-void Desktop::EarlyCommandLineArgsPrepare()
+void Desktop::CreateProcessServiceFactory()
 {
     Reference < XMultiServiceFactory > rSMgr = CreateApplicationServiceManager();
     if( rSMgr.is() )
@@ -738,7 +730,6 @@ void Desktop::EarlyCommandLineArgsPrepare()
         ::comphelper::setProcessServiceFactory( rSMgr );
     }
 }
-#endif
 
 void Desktop::DeInit()
 {
diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx
index a5dfe38..1e640c5 100644
--- a/desktop/source/app/sofficemain.cxx
+++ b/desktop/source/app/sofficemain.cxx
@@ -49,10 +49,10 @@ extern "C" int soffice_main()
     desktop::Desktop aDesktop;
     // This string is used during initialization of the Gtk+ VCL module
     aDesktop.SetAppName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("soffice")) );
+    aDesktop.CreateProcessServiceFactory();
 #ifdef UNX
     // handle --version and --help already here, otherwise they would be handled
     // after VCL initialization that might fail if $DISPLAY is not set
-    aDesktop.EarlyCommandLineArgsPrepare();
     desktop::CommandLineArgs* pCmdLineArgs = aDesktop.GetCommandLineArgs();
     if ( pCmdLineArgs->IsHelp() )
     {


More information about the Libreoffice-commits mailing list