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 | |
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')
-rw-r--r-- | starmath/inc/smmod.hxx | 3 | ||||
-rw-r--r-- | starmath/source/smdll.cxx | 17 |
2 files changed, 7 insertions, 13 deletions
diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index 6810c19252a4..fe6020716152 100644 --- a/starmath/inc/smmod.hxx +++ b/starmath/inc/smmod.hxx @@ -24,7 +24,6 @@ #include <svl/lstner.hxx> #include <svtools/colorcfg.hxx> -#include <tools/shl.hxx> #include "tools/rc.hxx" #include <sfx2/module.hxx> @@ -125,7 +124,7 @@ public: virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) override; }; -#define SM_MOD() ( *reinterpret_cast<SmModule**>(GetAppData(SHL_SM)) ) +#define SM_MOD() ( static_cast<SmModule*>(SfxApplication::GetModule(SfxToolsModule::Math)) ) #endif // INCLUDED_STARMATH_INC_SMMOD_HXX 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> {}; |