Kaydet (Commit) 67f5fa5a authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Demote Application::IsHeadlessModeRequested to local hack

Change-Id: I3ae51b8c57e70593153805e5c7c139573c543b5a
üst dbbfad3d
...@@ -1393,27 +1393,15 @@ public: ...@@ -1393,27 +1393,15 @@ public:
/** Enables headless mode. /** Enables headless mode.
@param dialogsAreFatal Set to true if a dialog ends the session, false if not. @param dialogsAreFatal Set to true if a dialog ends the session, false if not.
@see IsHeadlessModeEnabled, IsHeadlessModeRequested
*/ */
static void EnableHeadlessMode( bool dialogsAreFatal ); static void EnableHeadlessMode( bool dialogsAreFatal );
/** Determines if headless mode is enabled /** Determines if headless mode is enabled
@return True if headless mode is enabled, false if not. @return True if headless mode is enabled, false if not.
@see EnableHeadlessMode, IsHeadlessModeRequested
*/ */
static bool IsHeadlessModeEnabled(); 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 /** Enable Console Only mode
Used to disable Mac specific app init that requires an app bundle. Used to disable Mac specific app init that requires an app bundle.
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "rtl/tencinfo.h" #include "rtl/tencinfo.h"
#include "rtl/instance.hxx" #include "rtl/instance.hxx"
#include "rtl/process.h"
#include "tools/debug.hxx" #include "tools/debug.hxx"
#include "tools/time.hxx" #include "tools/time.hxx"
...@@ -1535,19 +1534,6 @@ bool Application::IsHeadlessModeEnabled() ...@@ -1535,19 +1534,6 @@ bool Application::IsHeadlessModeEnabled()
return IsDialogCancelEnabled(); 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; static bool bConsoleOnly = false;
bool Application::IsConsoleOnly() bool Application::IsConsoleOnly()
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "osl/process.h" #include "osl/process.h"
#include "rtl/bootstrap.hxx" #include "rtl/bootstrap.hxx"
#include "rtl/process.h"
#include "salinst.hxx" #include "salinst.hxx"
#include "generic/gensys.h" #include "generic/gensys.h"
...@@ -36,6 +37,25 @@ extern "C" { ...@@ -36,6 +37,25 @@ extern "C" {
typedef SalInstance*(*salFactoryProc)(); 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 oslModule pCloseModule = NULL;
static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = false ) static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = false )
...@@ -216,7 +236,7 @@ SalInstance *CreateSalInstance() ...@@ -216,7 +236,7 @@ SalInstance *CreateSalInstance()
SalInstance *pInst = NULL; SalInstance *pInst = NULL;
OUString aUsePlugin; OUString aUsePlugin;
if( Application::IsHeadlessModeRequested() ) if( IsHeadlessModeRequested() )
aUsePlugin = "svp"; aUsePlugin = "svp";
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment