diff options
-rw-r--r-- | include/vcl/svapp.hxx | 12 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 14 | ||||
-rw-r--r-- | vcl/unx/generic/plugadapt/salplug.cxx | 22 |
3 files changed, 21 insertions, 27 deletions
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index bb547d55e8bf..b4d69ba5aacd 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -1393,27 +1393,15 @@ public: /** Enables headless mode. @param dialogsAreFatal Set to true if a dialog ends the session, false if not. - - @see IsHeadlessModeEnabled, IsHeadlessModeRequested */ static void EnableHeadlessMode( bool dialogsAreFatal ); /** Determines if headless mode is enabled @return True if headless mode is enabled, false if not. - - @see EnableHeadlessMode, IsHeadlessModeRequested */ static bool IsHeadlessModeEnabled(); - /** Check command line arguments for \code --headless \endcode - - @return True if headless mode was requested, false if not - - @see EnableHeadlessMode, IsHeadlessModeEnabled - */ - static bool IsHeadlessModeRequested(); - /** Enable Console Only mode Used to disable Mac specific app init that requires an app bundle. diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 7c4a76d96f18..98b74540dd31 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -27,7 +27,6 @@ #include "rtl/tencinfo.h" #include "rtl/instance.hxx" -#include "rtl/process.h" #include "tools/debug.hxx" #include "tools/time.hxx" @@ -1535,19 +1534,6 @@ bool Application::IsHeadlessModeEnabled() return IsDialogCancelEnabled(); } -bool Application::IsHeadlessModeRequested() -{ - sal_uInt32 n = rtl_getAppCommandArgCount(); - for (sal_uInt32 i = 0; i < n; ++i) { - OUString arg; - rtl_getAppCommandArg(i, &arg.pData); - if ( arg == "--headless" || arg == "-headless" ) { - return true; - } - } - return false; -} - static bool bConsoleOnly = false; bool Application::IsConsoleOnly() diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx index 2049b7321867..e2870f39a8bd 100644 --- a/vcl/unx/generic/plugadapt/salplug.cxx +++ b/vcl/unx/generic/plugadapt/salplug.cxx @@ -21,6 +21,7 @@ #include "osl/process.h" #include "rtl/bootstrap.hxx" +#include "rtl/process.h" #include "salinst.hxx" #include "generic/gensys.h" @@ -36,6 +37,25 @@ extern "C" { typedef SalInstance*(*salFactoryProc)(); } +namespace { + +// HACK to obtain Application::IsHeadlessModeEnabled early on, before +// Application::EnableHeadlessMode has potentially been called: +bool IsHeadlessModeRequested() +{ + sal_uInt32 n = rtl_getAppCommandArgCount(); + for (sal_uInt32 i = 0; i < n; ++i) { + OUString arg; + rtl_getAppCommandArg(i, &arg.pData); + if ( arg == "--headless" || arg == "-headless" ) { + return true; + } + } + return false; +} + +} + static oslModule pCloseModule = NULL; static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = false ) @@ -216,7 +236,7 @@ SalInstance *CreateSalInstance() SalInstance *pInst = NULL; OUString aUsePlugin; - if( Application::IsHeadlessModeRequested() ) + if( IsHeadlessModeRequested() ) aUsePlugin = "svp"; else { |