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

Chris Sherlock chris.sherlock79 at gmail.com
Fri Nov 28 19:44:39 PST 2014


 include/vcl/svapp.hxx     |   13 ++++++-------
 vcl/source/app/svapp.cxx  |    6 ++++++
 vcl/source/app/svmain.cxx |    8 +-------
 3 files changed, 13 insertions(+), 14 deletions(-)

New commits:
commit a4b6266311a95347696bc79baa84ddd09f69366e
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Sat Nov 29 13:03:28 2014 +1100

    vcl: Remove DummyApplication
    
    DummyApplication is, frankly, a hack. Application is an abstract class because
    Application::Main() is a pure virtual function. However, as DummyApplication
    shows - this is not necessary because InitVCL() just makes a dummy app anyway.
    Anyone who uses Application::Main() will get a warning.
    
    Also: I want to move some of the global data into Application, and I can't do this
    whilst it is an abstract class. Given it's not necessary, then I'm getting rid of
    Main() as a pure virtual function.
    
    Change-Id: I425cf6feae4866f5670963ee9905f6161e421dd2

diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 92b5512..bb547d5 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -204,13 +204,12 @@ private:
 };
 
 /**
- @brief Abstract base class used mainly for the LibreOffice Desktop class.
+ @brief Base class used mainly for the LibreOffice Desktop class.
 
- The Application class is an abstract class with one pure virtual
- function: Main(), however, there are a \em lot of static functions
- that are vital for applications. It is really meant to be subclassed
- to provide a global singleton, and heavily relies on a single data
- structure ImplSVData
+ The Application class is a base class mainly used by the Desktop
+ class. It is really meant to be subclassed, and the Main() function
+ should be overridden. Many of the ImplSVData members should be
+ moved to this class.
 
  The reason Application exists is because the VCL used to be a
  standalone framework, long since abandoned by anything other than
@@ -342,7 +341,7 @@ public:
 
     vcl/fpicker/test/svdem.cxx
     */
-    virtual int                 Main() = 0;
+    virtual int                 Main();
 
     /** Exit from the application
 
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 29f160e..7c4a76d 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -209,6 +209,12 @@ Application::~Application()
     ImplDestroySVData();
 }
 
+int Application::Main()
+{
+    SAL_WARN("vcl", "Application is a base class and should be overridden.");
+    return EXIT_SUCCESS;
+}
+
 bool Application::QueryExit()
 {
     WorkWindow* pAppWin = ImplGetSVData()->maWinData.mpAppWin;
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index bd3544b..c43fc57 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -200,12 +200,6 @@ static Application *        pOwnSvApp = NULL;
 // Exception handler. pExceptionHandler != NULL => VCL already inited
 oslSignalHandler   pExceptionHandler = NULL;
 
-class DummyApplication : public Application
-{
-public:
-    int                Main() SAL_OVERRIDE { return EXIT_SUCCESS; };
-};
-
 class DesktopEnvironmentContext: public cppu::WeakImplHelper1< com::sun::star::uno::XCurrentContext >
 {
 public:
@@ -248,7 +242,7 @@ bool InitVCL()
 
     if( !ImplGetSVData()->mpApp )
     {
-        pOwnSvApp = new DummyApplication();
+        pOwnSvApp = new Application();
     }
     InitSalMain();
 


More information about the Libreoffice-commits mailing list