diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-11-29 13:03:28 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-11-29 13:11:55 +1100 |
commit | a4b6266311a95347696bc79baa84ddd09f69366e (patch) | |
tree | c340e45325bea68b5c3ba1370fe3c938c6d76df7 | |
parent | 03c049a093c9ed0451099325d73429b010e71594 (diff) |
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
-rw-r--r-- | include/vcl/svapp.hxx | 13 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 6 | ||||
-rw-r--r-- | vcl/source/app/svmain.cxx | 8 |
3 files changed, 13 insertions, 14 deletions
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index 92b5512d21fb..bb547d55e8bf 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 29f160e069c2..7c4a76d96f18 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 bd3544bc125a..c43fc578f33b 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(); |