summaryrefslogtreecommitdiff
path: root/sw
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 /sw
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 'sw')
-rw-r--r--sw/CppunitTest_sw_htmlexport.mk1
-rw-r--r--sw/inc/swmodule.hxx3
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx1
-rw-r--r--sw/source/uibase/app/swdll.cxx11
4 files changed, 7 insertions, 9 deletions
diff --git a/sw/CppunitTest_sw_htmlexport.mk b/sw/CppunitTest_sw_htmlexport.mk
index a0dc5c118f43..7a9e07696a71 100644
--- a/sw/CppunitTest_sw_htmlexport.mk
+++ b/sw/CppunitTest_sw_htmlexport.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_htmlexport, \
cppuhelper \
i18nlangtag \
sal \
+ sfx \
sw \
test \
tl \
diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index eb5607e8d709..2d088022fe1e 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -23,7 +23,6 @@
#include <unotools/options.hxx>
#include <sfx2/module.hxx>
-#include <tools/shl.hxx>
#include "swdllapi.h"
#include "shellid.hxx"
#include <fldupde.hxx>
@@ -248,7 +247,7 @@ inline const css::uno::Reference< css::linguistic2::XLinguServiceEventListener >
// Access to SwModule, the View and the shell.
-#define SW_MOD() ( *reinterpret_cast<SwModule**>(GetAppData(SHL_WRITER)))
+#define SW_MOD() ( static_cast<SwModule*>(SfxApplication::GetModule(SfxToolsModule::Writer)))
SW_DLLPUBLIC SwView* GetActiveView();
SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 69b6b7db6c54..d6453aa81af3 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -50,7 +50,6 @@ private:
if (OString(filename) == "charborder.odt")
{
-
// FIXME if padding-top gets exported as inches, not cms, we get rounding errors.
SwGlobals::ensure(); // make sure that SW_MOD() is not 0
std::unique_ptr<Resetter> pResetter(new Resetter(
diff --git a/sw/source/uibase/app/swdll.cxx b/sw/source/uibase/app/swdll.cxx
index 803c2b8cc376..e9fa7f196e31 100644
--- a/sw/source/uibase/app/swdll.cxx
+++ b/sw/source/uibase/app/swdll.cxx
@@ -48,7 +48,7 @@
#include <unomid.h>
#include "swdllimpl.hxx"
-
+#include <o3tl/make_unique.hxx>
using namespace com::sun::star;
namespace
@@ -81,9 +81,7 @@ namespace SwGlobals
SwDLL::SwDLL()
{
- // the SdModule must be created
- SwModule** ppShlPtr = reinterpret_cast<SwModule**>(GetAppData(SHL_WRITER));
- if ( *ppShlPtr )
+ if ( SfxApplication::GetModule(SfxToolsModule::Writer) ) // Module already active
return;
std::unique_ptr<SvtModuleOptions> xOpt;
@@ -99,8 +97,9 @@ SwDLL::SwDLL()
SfxObjectFactory* pWDocFact = &SwWebDocShell::Factory();
- SwModule* pModule = new SwModule( pWDocFact, pDocFact, pGlobDocFact );
- *ppShlPtr = pModule;
+ auto pUniqueModule = o3tl::make_unique<SwModule>(pWDocFact, pDocFact, pGlobDocFact);
+ SwModule* pModule = pUniqueModule.get();
+ SfxApplication::SetModule(SfxToolsModule::Writer, std::move(pUniqueModule));
pWDocFact->SetDocumentServiceName("com.sun.star.text.WebDocument");