summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMark Page <aptitude@btconnect.com>2016-07-04 17:30:42 +0100
committerNoel Grandin <noelgrandin@gmail.com>2016-07-13 06:32:46 +0000
commitf7b1cd66167050afecf487e3d89ea12de74200b5 (patch)
tree75381b63bb5dca7ed1fa2ff5602064750f46f042 /sc
parent633413a37ee7442cd899db1269fd3ef404efe58a (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 'sc')
-rw-r--r--sc/inc/scmod.hxx3
-rw-r--r--sc/source/ui/app/scdll.cxx9
2 files changed, 6 insertions, 6 deletions
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index c80b0ba43b3f..e6fa35247cc8 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -28,7 +28,6 @@
#include "global.hxx"
#include "shellids.hxx"
#include <unotools/options.hxx>
-#include <tools/shl.hxx>
#include <map>
#include <list>
@@ -255,7 +254,7 @@ public:
SC_DLLPUBLIC vcl::Window * Find1RefWindow( sal_uInt16 nSlotId, vcl::Window *pWndAncestor );
};
-#define SC_MOD() ( *reinterpret_cast<ScModule**>(GetAppData(SHL_CALC)) )
+#define SC_MOD() ( static_cast<ScModule*>(SfxApplication::GetModule(SfxToolsModule::Calc)) )
void global_InitAppOptions();
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 9a14c78ee23f..2e3ba3a9474a 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -102,6 +102,7 @@
#include "dwfunctr.hxx"
#include "acredlin.hxx"
+#include <o3tl/make_unique.hxx>
ScResId::ScResId( sal_uInt16 nId ) :
ResId( nId, *SC_MOD()->GetResMgr() )
@@ -110,14 +111,14 @@ ScResId::ScResId( sal_uInt16 nId ) :
void ScDLL::Init()
{
- ScModule **ppShlPtr = reinterpret_cast<ScModule**>(GetAppData(SHL_CALC));
- if ( *ppShlPtr )
+ if ( SfxApplication::GetModule(SfxToolsModule::Calc) ) // Module already active
return;
ScDocumentPool::InitVersionMaps(); // Is needed in the ScModule ctor
- ScModule* pMod = new ScModule( &ScDocShell::Factory() );
- (*ppShlPtr) = pMod;
+ auto pUniqueModule = o3tl::make_unique<ScModule>(&ScDocShell::Factory());
+ ScModule* pMod = pUniqueModule.get();
+ SfxApplication::SetModule(SfxToolsModule::Calc, std::move(pUniqueModule));
ScDocShell::Factory().SetDocumentServiceName( "com.sun.star.sheet.SpreadsheetDocument" );