summaryrefslogtreecommitdiff
path: root/sd/source/filter/cgm
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 /sd/source/filter/cgm
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 'sd/source/filter/cgm')
-rw-r--r--sd/source/filter/cgm/sdcgmfilter.cxx47
1 files changed, 38 insertions, 9 deletions
diff --git a/sd/source/filter/cgm/sdcgmfilter.cxx b/sd/source/filter/cgm/sdcgmfilter.cxx
index 6c6ef43ce22a..7135ee81fc1d 100644
--- a/sd/source/filter/cgm/sdcgmfilter.cxx
+++ b/sd/source/filter/cgm/sdcgmfilter.cxx
@@ -66,8 +66,16 @@ using namespace ::com::sun::star::frame;
// - Typedefs -
// ------------
-typedef sal_uInt32 ( __LOADONCALLAPI *ImportCGM )( ::rtl::OUString&, Reference< XModel >&, sal_uInt32, Reference< XStatusIndicator >& );
-typedef sal_Bool ( __LOADONCALLAPI *ExportCGM )( ::rtl::OUString&, Reference< XModel >&, Reference< XStatusIndicator >&, void* );
+
+typedef sal_uInt32 ( __LOADONCALLAPI *ImportCGMPointer )( ::rtl::OUString&, Reference< XModel >&, sal_uInt32, Reference< XStatusIndicator >& );
+typedef sal_Bool ( __LOADONCALLAPI *ExportCGMPointer )( ::rtl::OUString&, Reference< XModel >&, Reference< XStatusIndicator >&, void* );
+
+#ifdef DISABLE_DYNLOADING
+
+extern "C" sal_uInt32 ImportCGM( ::rtl::OUString&, Reference< XModel >&, sal_uInt32, Reference< XStatusIndicator >& );
+extern "C" sal_Bool ExportCGM( ::rtl::OUString&, Reference< XModel >&, Reference< XStatusIndicator >&, void* );
+
+#endif
// ---------------
// - SdPPTFilter -
@@ -88,12 +96,22 @@ SdCGMFilter::~SdCGMFilter()
sal_Bool SdCGMFilter::Import()
{
+#ifndef DISABLE_DYNLOADING
::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() );
+#endif
sal_Bool bRet = sal_False;
- if( pLibrary && mxModel.is() )
+ if(
+#ifndef DISABLE_DYNLOADING
+ pLibrary &&
+#endif
+ mxModel.is() )
{
- ImportCGM FncImportCGM = reinterpret_cast< ImportCGM >( pLibrary->getFunctionSymbol( "ImportCGM" ) );
+#ifndef DISABLE_DYNLOADING
+ ImportCGMPointer FncImportCGM = reinterpret_cast< ImportCGM >( pLibrary->getFunctionSymbol( "ImportCGM" ) );
+#else
+ ImportCGMPointer FncImportCGM = ImportCGM;
+#endif
::rtl::OUString aFileURL( mrMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) );
sal_uInt32 nRetValue;
@@ -122,9 +140,9 @@ sal_Bool SdCGMFilter::Import()
}
}
}
-
+#ifndef DISABLE_DYNLOADING
delete pLibrary;
-
+#endif
return bRet;
}
@@ -132,12 +150,22 @@ sal_Bool SdCGMFilter::Import()
sal_Bool SdCGMFilter::Export()
{
+#ifndef DISABLE_DYNLOADING
::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() );
+#endif
sal_Bool bRet = sal_False;
- if( pLibrary && mxModel.is() )
+ if(
+#ifndef DISABLE_DYNLOADING
+ pLibrary &&
+#endif
+ mxModel.is() )
{
- ExportCGM FncCGMExport = reinterpret_cast< ExportCGM >( pLibrary->getFunctionSymbol( "ExportCGM" ) );
+#ifndef DISABLE_DYNLOADING
+ ExportCGMPointer FncCGMExport = reinterpret_cast< ExportCGM >( pLibrary->getFunctionSymbol( "ExportCGM" ) );
+#else
+ ExportCGMPointer FncCGMExport = ExportCGM;
+#endif
if( FncCGMExport )
{
@@ -148,8 +176,9 @@ sal_Bool SdCGMFilter::Export()
}
}
+#ifndef DISABLE_DYNLOADING
delete pLibrary;
-
+#endif
return bRet;
}