[Libreoffice-commits] core.git: include/vcl vcl/source vcl/unx

Stephan Bergmann sbergman at redhat.com
Wed Dec 10 08:50:32 PST 2014


 include/vcl/svapp.hxx                 |   12 ------------
 vcl/source/app/svapp.cxx              |   14 --------------
 vcl/unx/generic/plugadapt/salplug.cxx |   22 +++++++++++++++++++++-
 3 files changed, 21 insertions(+), 27 deletions(-)

New commits:
commit 67f5fa5a23c9678a83eb75534307385475f1d586
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Dec 10 17:49:47 2014 +0100

    Demote Application::IsHeadlessModeRequested to local hack
    
    Change-Id: I3ae51b8c57e70593153805e5c7c139573c543b5a

diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index bb547d5..b4d69ba 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 7c4a76d..98b7454 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 2049b73..e2870f3 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
     {


More information about the Libreoffice-commits mailing list