summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2012-10-07 07:52:26 +0300
committerTor Lillqvist <tml@iki.fi>2012-10-07 07:59:15 +0300
commit97593ae24a98daca89fad176dc2492e582b3a821 (patch)
treef52189545a5c5ffbc7cece7bca595b2cd18c9cc0 /sw
parent1691752dd29d661552700d9bcac5d3a3953fb91a (diff)
Handle lack of module loading/unloading API when DISABLE_DYNLOADING
There are basicically two classes of cases: 1) Where the code is for obscure historical reasons or what I see as misguided "optimization" split into a more libraries than necessary, and these then are loaded at run-time. Instead, just use direct linking. 2) Where dynamic loading is part of the functionality offered to some upper (scripting etc) layer, or where some system-specific non-LO library is loaded dynamically, as it is not necessarily present on end-user machines. Can't have such in the DISABLE_DYNLOADING case. Change-Id: I9eceac5fb635245def2f4f3320821447bb7cd8c0
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/init.hxx3
-rw-r--r--sw/source/filter/basflt/fltini.cxx55
-rw-r--r--sw/source/ui/dbui/swdbtoolsclient.cxx14
-rw-r--r--sw/source/ui/dialog/swabstdlg.cxx12
-rw-r--r--sw/source/ui/dialog/swuiexp.cxx4
5 files changed, 83 insertions, 5 deletions
diff --git a/sw/inc/init.hxx b/sw/inc/init.hxx
index daad12c42c67..9fe7fd9f3e70 100644
--- a/sw/inc/init.hxx
+++ b/sw/inc/init.hxx
@@ -47,8 +47,9 @@ public:
Filters();
~Filters();
-
+#ifndef DISABLE_DYNLOADING
oslGenericFunction GetMswordLibSymbol( const char *pSymbol );
+#endif
private:
osl::Module msword_;
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index 659177565f63..13fb977523bf 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -126,8 +126,12 @@ inline void _SetFltPtr( sal_uInt16 rPos, SwRead pReader )
namespace {
+#ifndef DISABLE_DYNLOADING
+
extern "C" { static void SAL_CALL thisModule() {} }
+#endif
+
}
namespace sw {
@@ -153,6 +157,8 @@ Filters::~Filters()
}
}
+#ifndef DISABLE_DYNLOADING
+
oslGenericFunction Filters::GetMswordLibSymbol( const char *pSymbol )
{
if (!msword_.is())
@@ -165,6 +171,8 @@ oslGenericFunction Filters::GetMswordLibSymbol( const char *pSymbol )
return NULL;
}
+#endif
+
}
namespace SwReaderWriter {
@@ -818,44 +826,75 @@ void SwAsciiOptions::WriteUserData( String& rStr )
rStr += ',';
}
+#ifdef DISABLE_DYNLOADING
+
+extern "C" {
+ Reader *ImportRTF();
+ void ExportRTF( const String&, const String& rBaseURL, WriterRef& );
+ Reader *ImportDOC();
+ void ExportDOC( const String&, const String& rBaseURL, WriterRef& );
+ sal_uLong SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const String& );
+ sal_uLong GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell& );
+}
+
+#endif
+
Reader* GetRTFReader()
{
+#ifndef DISABLE_DYNLOADING
+
FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportRTF" ) );
if ( pFunction )
return (*pFunction)();
return NULL;
+#else
+ return ImportRTF();
+#endif
+
}
void GetRTFWriter( const String& rFltName, const String& rBaseURL, WriterRef& xRet )
{
+#ifndef DISABLE_DYNLOADING
FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportRTF" ) );
if ( pFunction )
(*pFunction)( rFltName, rBaseURL, xRet );
else
xRet = WriterRef(0);
+#else
+ ExportRTF( rFltName, rBaseURL, xRet );
+#endif
}
Reader* GetWW8Reader()
{
+#ifndef DISABLE_DYNLOADING
FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOC" ) );
if ( pFunction )
return (*pFunction)();
return NULL;
+#else
+ return ImportDOC();
+#endif
}
void GetWW8Writer( const String& rFltName, const String& rBaseURL, WriterRef& xRet )
{
+#ifndef DISABLE_DYNLOADING
FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportDOC" ) );
if ( pFunction )
(*pFunction)( rFltName, rBaseURL, xRet );
else
xRet = WriterRef(0);
+#else
+ ExportDOC( rFltName, rBaseURL, xRet );
+#endif
}
typedef sal_uLong ( __LOADONCALLAPI *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const String& );
@@ -863,18 +902,26 @@ typedef sal_uLong ( __LOADONCALLAPI *GetSaveWarning )( SfxObjectShell& );
sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, sal_Bool bSaveInto, const String& rStorageName )
{
+#ifndef DISABLE_DYNLOADING
SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( SwGlobals::getFilters().GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) );
if( pFunction )
- return pFunction( rDoc, rStor, bSaveInto, rStorageName );
- return ERRCODE_NONE;
+ return pFunction( rDoc, rStor, bSaveInto, rStorageName );
+ return ERRCODE_NONE;
+#else
+ return SaveOrDelMSVBAStorage_ww8( rDoc, rStor, bSaveInto, rStorageName );
+#endif
}
sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS )
{
+#ifndef DISABLE_DYNLOADING
GetSaveWarning pFunction = reinterpret_cast<GetSaveWarning>( SwGlobals::getFilters().GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) );
if( pFunction )
- return pFunction( rDocS );
- return ERRCODE_NONE;
+ return pFunction( rDocS );
+ return ERRCODE_NONE;
+#else
+ return GetSaveWarningOfMSVBAStorage_ww8( rDocS );
+#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dbui/swdbtoolsclient.cxx b/sw/source/ui/dbui/swdbtoolsclient.cxx
index e18db2b4138a..cf1ebf58e142 100644
--- a/sw/source/ui/dbui/swdbtoolsclient.cxx
+++ b/sw/source/ui/dbui/swdbtoolsclient.cxx
@@ -94,8 +94,16 @@ SwDbtoolsClient::~SwDbtoolsClient()
}
}
+#ifndef DISABLE_DYNLOADING
+
extern "C" { static void SAL_CALL thisModule() {} }
+#else
+
+extern "C" void * createDataAccessToolsFactory();
+
+#endif
+
void SwDbtoolsClient::registerClient()
{
::osl::MutexGuard aGuard(getDbtoolsClientMutex());
@@ -104,6 +112,7 @@ void SwDbtoolsClient::registerClient()
OSL_ENSURE(NULL == getDbToolsClientModule(), "SwDbtoolsClient::registerClient: inconsistence: already have a module!");
OSL_ENSURE(NULL == getDbToolsClientFactoryFunction(), "SwDbtoolsClient::registerClient: inconsistence: already have a factory function!");
+#ifndef DISABLE_DYNLOADING
const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY("dbtools")));
// load the dbtools library
@@ -125,6 +134,9 @@ void SwDbtoolsClient::registerClient()
getDbToolsClientModule() = NULL;
}
}
+#else
+ getDbToolsClientFactoryFunction() = createDataAccessToolsFactory;
+#endif
}
}
@@ -133,9 +145,11 @@ void SwDbtoolsClient::revokeClient()
::osl::MutexGuard aGuard(getDbtoolsClientMutex());
if (0 == --getDbToolsClientClients())
{
+#ifndef DISABLE_DYNLOADING
getDbToolsClientFactoryFunction() = NULL;
if (getDbToolsClientModule())
osl_unloadModule(getDbToolsClientModule());
+#endif
getDbToolsClientModule() = NULL;
}
}
diff --git a/sw/source/ui/dialog/swabstdlg.cxx b/sw/source/ui/dialog/swabstdlg.cxx
index 982f74520c09..8efc77f721b3 100644
--- a/sw/source/ui/dialog/swabstdlg.cxx
+++ b/sw/source/ui/dialog/swabstdlg.cxx
@@ -35,10 +35,19 @@
typedef SwAbstractDialogFactory* (__LOADONCALLAPI *SwFuncPtrCreateDialogFactory)();
+#ifndef DISABLE_DYNLOADING
+
extern "C" { static void SAL_CALL thisModule() {} }
+#else
+
+extern "C" SwAbstractDialogFactory* SwCreateDialogFactory();
+
+#endif
+
SwAbstractDialogFactory* SwAbstractDialogFactory::Create()
{
+#ifndef DISABLE_DYNLOADING
SwFuncPtrCreateDialogFactory fp = 0;
static ::osl::Module aDialogLibrary;
static const ::rtl::OUString sLibName(::vcl::unohelper::CreateLibraryName("swui", sal_True));
@@ -49,6 +58,9 @@ SwAbstractDialogFactory* SwAbstractDialogFactory::Create()
if ( fp )
return fp();
return 0;
+#else
+ return SwCreateDialogFactory();
+#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dialog/swuiexp.cxx b/sw/source/ui/dialog/swuiexp.cxx
index 62d92c277eb5..7b92e8928b9c 100644
--- a/sw/source/ui/dialog/swuiexp.cxx
+++ b/sw/source/ui/dialog/swuiexp.cxx
@@ -33,6 +33,10 @@ namespace swui
}
}
+#ifdef DISABLE_DYNLOADING
+#define CreateDialogFactory SwCreateDialogFactory
+#endif
+
extern "C"
{
SAL_DLLPUBLIC_EXPORT SwAbstractDialogFactory* CreateDialogFactory()