summaryrefslogtreecommitdiff
path: root/sd
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 /sd
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 'sd')
-rw-r--r--sd/inc/sddll.hxx6
-rw-r--r--sd/inc/sdmod.hxx3
-rw-r--r--sd/qa/unit/misc-tests.cxx1
-rw-r--r--sd/source/core/drawdoc4.cxx1
-rw-r--r--sd/source/ui/app/sddll.cxx31
-rw-r--r--sd/source/ui/app/sdmod.cxx5
6 files changed, 14 insertions, 33 deletions
diff --git a/sd/inc/sddll.hxx b/sd/inc/sddll.hxx
index 6f8a04957f4f..8b05dc5270c4 100644
--- a/sd/inc/sddll.hxx
+++ b/sd/inc/sddll.hxx
@@ -23,6 +23,8 @@
#include <sfx2/module.hxx>
#include "sddllapi.h"
+class SdModule;
+
/*************************************************************************
|*
|* This class is a wrapper for a Load-On-Demand-DLL. One instance
@@ -40,8 +42,8 @@ protected:
static void RegisterRemotes();
#endif
static void RegisterFactorys();
- static void RegisterInterfaces();
- static void RegisterControllers();
+ static void RegisterInterfaces(SdModule* pMod);
+ static void RegisterControllers(SdModule* pMod);
public:
// Ctor/Dtor must be linked to the application
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx
index 7293b65f3061..cb5f2c3adbaa 100644
--- a/sd/inc/sdmod.hxx
+++ b/sd/inc/sdmod.hxx
@@ -24,7 +24,6 @@
#include "pres.hxx"
#include <sot/storage.hxx>
-#include <tools/shl.hxx>
#include "sddllapi.h"
#include <svl/itemprop.hxx>
#include <svl/lstner.hxx>
@@ -192,7 +191,7 @@ private:
};
-#define SD_MOD() ( *reinterpret_cast<SdModule**>(GetAppData(SHL_DRAW)) )
+#define SD_MOD() ( static_cast<SdModule*>(SfxApplication::GetModule(SfxToolsModule::Draw)) )
#endif // INCLUDED_SD_INC_SDMOD_HXX
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index bc73b5f33a21..c25abc6ac6c4 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -23,7 +23,6 @@
#include <osl/thread.hxx>
#include <FactoryIds.hxx>
#include <sdmod.hxx>
-#include <tools/shl.hxx>
#include <svx/sdr/table/tablecontroller.hxx>
#include <sfx2/request.hxx>
#include <svx/svxids.hrc>
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index c19c67013d02..ed0c55bdf306 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -85,7 +85,6 @@
#include <svx/svditer.hxx>
#include <svx/svdogrp.hxx>
#include <svx/svdlayer.hxx>
-#include <tools/shl.hxx>
#include <editeng/numitem.hxx>
#include <editeng/editeng.hxx>
#include <editeng/unolingu.hxx>
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index 957639119e20..6a2758308c43 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -94,6 +94,7 @@
#include <sfx2/sidebar/SidebarChildWindow.hxx>
#include <vcl/FilterConfigItem.hxx>
#include <comphelper/processfactory.hxx>
+#include <o3tl/make_unique.hxx>
using namespace ::com::sun::star;
@@ -119,10 +120,9 @@ void SdDLL::RegisterFactorys()
// Register all Interfaces
-void SdDLL::RegisterInterfaces()
+void SdDLL::RegisterInterfaces(SdModule* pMod)
{
// Module
- SfxModule* pMod = SD_MOD();
SdModule::RegisterInterface(pMod);
// View shell base.
@@ -157,10 +157,8 @@ void SdDLL::RegisterInterfaces()
// Register all Controllers
-void SdDLL::RegisterControllers()
+void SdDLL::RegisterControllers(SdModule* pMod)
{
- SfxModule* pMod = SD_MOD();
-
SdTbxCtlDiaPages::RegisterControl( SID_PAGES_PER_ROW, pMod );
SdTbxCtlGlueEscDir::RegisterControl( SID_GLUE_ESCDIR, pMod );
@@ -244,7 +242,7 @@ void SdDLL::RegisterControllers()
void SdDLL::Init()
{
- if ( SD_MOD() )
+ if ( SfxApplication::GetModule(SfxToolsModule::Draw) ) // Module already active
return;
SfxObjectFactory* pDrawFact = nullptr;
@@ -256,20 +254,9 @@ void SdDLL::Init()
if (!utl::ConfigManager::IsAvoidConfig() && SvtModuleOptions().IsDraw())
pDrawFact = &::sd::GraphicDocShell::Factory();
- // the SdModule must be created
- SdModule** ppShlPtr = reinterpret_cast<SdModule**>(GetAppData(SHL_DRAW));
-
- // #i46427#
- // The SfxModule::SfxModule stops when the first given factory
- // is 0, so we must not give a 0 as first factory
- if( pImpressFact )
- {
- (*ppShlPtr) = new SdModule( pImpressFact, pDrawFact );
- }
- else
- {
- (*ppShlPtr) = new SdModule( pDrawFact, pImpressFact );
- }
+ auto pUniqueModule = o3tl::make_unique<SdModule>(pImpressFact, pDrawFact);
+ SdModule* pModule = pUniqueModule.get();
+ SfxApplication::SetModule(SfxToolsModule::Draw, std::move(pUniqueModule));
if (!utl::ConfigManager::IsAvoidConfig() && SvtModuleOptions().IsImpress())
{
@@ -287,10 +274,10 @@ void SdDLL::Init()
RegisterFactorys();
// register your shell-interfaces here
- RegisterInterfaces();
+ RegisterInterfaces(pModule);
// register your controllers here
- RegisterControllers();
+ RegisterControllers(pModule);
// register SvDraw-Fields
SdrRegisterFieldClasses();
diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
index 1f821f0b652f..f665d7f5960a 100644
--- a/sd/source/ui/app/sdmod.cxx
+++ b/sd/source/ui/app/sdmod.cxx
@@ -110,11 +110,6 @@ SdModule::~SdModule()
mpResourceContainer.reset();
- // Mark the module in the global AppData structure as deleted.
- SdModule** ppShellPointer = reinterpret_cast<SdModule**>(GetAppData(SHL_DRAW));
- if (ppShellPointer != nullptr)
- (*ppShellPointer) = nullptr;
-
delete mpErrorHdl;
mpVirtualRefDevice.disposeAndClear();
}