desktop/source/app/cmdlineargs.hxx |    2 ++
 desktop/source/lib/init.cxx        |   25 ++++++++-----------------
 2 files changed, 10 insertions(+), 17 deletions(-)

New commits:
commit 07c54fff7ad9da498acd482148e491b879766bd4
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Wed Dec 10 12:31:15 2014 +0100

    Fake --headless more cleanly
    
    Change-Id: I3c119182c093b625b57ebc1c23986cab7faf09b0

diff --git a/desktop/source/app/cmdlineargs.hxx 
b/desktop/source/app/cmdlineargs.hxx
index 74c8c0e..0ab54e0 100644
--- a/desktop/source/app/cmdlineargs.hxx
+++ b/desktop/source/app/cmdlineargs.hxx
@@ -111,6 +111,8 @@ class CommandLineArgs: private boost::noncopyable
         // Special analyzed states (does not match directly to a command line 
parameter!)
         bool IsEmpty() const { return m_bEmpty;}
 
+        void setHeadless() { m_headless = true; }
+
     private:
         void                    ParseCommandLine_Impl( Supplier& supplier );
         void                    InitParamValues();
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 659be67..5a410e4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -48,6 +48,7 @@
 #include <unotools/mediadescriptor.hxx>
 #include <osl/module.hxx>
 
+#include <app.hxx>
 #include <salinst.hxx>
 
 // Tiled Rendering is Linux only for now.
@@ -59,7 +60,8 @@
 #include <basebmp/bitmapdevice.hxx>
 #endif
 
-// We also need to hackily be able to start the main libreoffice thread
+#include "../app/cmdlineargs.hxx"
+// We also need to hackily be able to start the main libreoffice thread:
 #include "../app/sofficemain.h"
 #include "../app/officeipcthread.hxx"
 
@@ -722,22 +724,6 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath)
 
     try
     {
-        // We specifically need to make sure we have the "headless"
-        // command arg set (various code specifically checks via
-        // CommandLineArgs). We could alternatively add some other
-        // flag elsewhere to indicate headlessness, which would
-        // then be set from here or via CommandLineArgs.
-        // (The first argument is treated specially by osl_setCommandArgs
-        // however it is valid to make it \0 instead.)
-        char sName[] = "";
-        char sHeadless[] = "--headless";
-        char* pArgs[2] = { sName, sHeadless };
-
-        // If we've set up the command args elsewhere then we cannot do it
-        // again (as an assert will fire), this will be the case e.g.
-        // for unit tests (and possibly if UNO is being used in addition
-        // to LOK in an external program).
-        osl_setCommandArgs(2, pArgs);
         SAL_INFO("lok", "Attempting to initalize UNO");
         if (!initialize_uno(aAppURL))
         {
@@ -749,6 +735,11 @@ static int lo_initialize(LibreOfficeKit* pThis, const 
char* pAppPath)
         // Force headless -- this is only for bitmap rendering.
         rtl::Bootstrap::set("SAL_USE_VCLPLUGIN", "svp");
 
+        // We specifically need to make sure we have the "headless"
+        // command arg set (various code specifically checks via
+        // CommandLineArgs):
+        desktop::Desktop::GetCommandLineArgs().setHeadless();
+
         // We could use InitVCL() here -- and used to before using 
soffice_main,
         // however that now deals with the initialisation for us (and it's not
         // possible to try to set up VCL twice.
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to