summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-12-10 12:31:15 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-12-10 12:31:15 +0100
commit07c54fff7ad9da498acd482148e491b879766bd4 (patch)
tree20ab8f8e104d41bffbfc5bebc4d0edcdb9591f75 /desktop
parent2621a852eb089b7f1edcab88a703d83b2f2fbb41 (diff)
Fake --headless more cleanly
Change-Id: I3c119182c093b625b57ebc1c23986cab7faf09b0
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/cmdlineargs.hxx2
-rw-r--r--desktop/source/lib/init.cxx25
2 files changed, 10 insertions, 17 deletions
diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx
index 74c8c0e2bf45..0ab54e072125 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 659be67ae379..5a410e47e2b8 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.