diff options
author | Mark Page <aptitude@btconnect.com> | 2016-07-04 17:30:42 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-07-13 06:32:46 +0000 |
commit | f7b1cd66167050afecf487e3d89ea12de74200b5 (patch) | |
tree | 75381b63bb5dca7ed1fa2ff5602064750f46f042 /starmath/source/smdll.cxx | |
parent | 633413a37ee7442cd899db1269fd3ef404efe58a (diff) |
Moved SfxModule owner to SfxApplication
::GetAppData replaced with SfxApplication::GetModule
that now returns SfxModule*
SfxModule no longer registers self for ownership
instead it is now registered using SfxApplication::SetModule
Change-Id: Ifbbe1b2b4c5122da8e643b7926d47878d116c6c8
Reviewed-on: https://gerrit.libreoffice.org/26914
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'starmath/source/smdll.cxx')
-rw-r--r-- | starmath/source/smdll.cxx | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/starmath/source/smdll.cxx b/starmath/source/smdll.cxx index 738a6c51abbc..64e16de81ec6 100644 --- a/starmath/source/smdll.cxx +++ b/starmath/source/smdll.cxx @@ -38,6 +38,7 @@ #include <starmath.hrc> #include <svx/xmlsecctrl.hxx> +#include <o3tl/make_unique.hxx> namespace { @@ -50,13 +51,14 @@ namespace SmDLL::SmDLL() { - SmModule** ppShlPtr = reinterpret_cast<SmModule**>(GetAppData(SHL_SM)); - if ( *ppShlPtr ) + if ( SfxApplication::GetModule(SfxToolsModule::Math) ) // Module already active return; SfxObjectFactory& rFactory = SmDocShell::Factory(); - SmModule *pModule = new SmModule( &rFactory ); - *ppShlPtr = pModule; + + auto pUniqueModule = o3tl::make_unique<SmModule>(&rFactory); + SmModule* pModule = pUniqueModule.get(); + SfxApplication::SetModule(SfxToolsModule::Math, std::move(pUniqueModule)); rFactory.SetDocumentServiceName( "com.sun.star.formula.FormulaProperties" ); @@ -79,13 +81,6 @@ namespace SmDLL::~SmDLL() { -#if 0 - // the SdModule must be destroyed - SmModule** ppShlPtr = (SmModule**) GetAppData(SHL_SM); - delete (*ppShlPtr); - (*ppShlPtr) = NULL; - *GetAppData(SHL_SM) = 0; -#endif } struct theSmDLLInstance : public rtl::Static<SmDLL, theSmDLLInstance> {}; |