diff options
author | Tor Lillqvist <tml@iki.fi> | 2012-10-07 07:52:26 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2012-10-07 07:59:15 +0300 |
commit | 97593ae24a98daca89fad176dc2492e582b3a821 (patch) | |
tree | f52189545a5c5ffbc7cece7bca595b2cd18c9cc0 /sfx2 | |
parent | 1691752dd29d661552700d9bcac5d3a3953fb91a (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 'sfx2')
-rw-r--r-- | sfx2/source/appl/appinit.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 33 |
2 files changed, 43 insertions, 2 deletions
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 4d53e49d5fc5..d79f838118f6 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -166,8 +166,16 @@ typedef bool ( *PFunc_getSpecialCharsForEdit)( Window* i_pParent, const Font& i_ // a library above us. //==================================================================== +#ifndef DISABLE_DYNLOADING + extern "C" { static void SAL_CALL thisModule() {} } +#else + +extern "C" bool GetSpecialCharsForEdit( Window* i_pParent, const Font& i_rFont, String& o_rOutString ); + +#endif + String GetSpecialCharsForEdit(Window* pParent, const Font& rFont) { static bool bDetermineFunction = false; @@ -178,6 +186,7 @@ String GetSpecialCharsForEdit(Window* pParent, const Font& rFont) { bDetermineFunction = true; +#ifndef DISABLE_DYNLOADING static ::rtl::OUString aLibName( SVLIBRARY( "cui" ) ); oslModule handleMod = osl_loadModuleRelative( &thisModule, aLibName.pData, 0 ); @@ -186,6 +195,9 @@ String GetSpecialCharsForEdit(Window* pParent, const Font& rFont) ::rtl::OUString aSymbol( "GetSpecialCharsForEdit" ); pfunc_getSpecialCharsForEdit = (PFunc_getSpecialCharsForEdit)osl_getFunctionSymbol( handleMod, aSymbol.pData ); DBG_ASSERT( pfunc_getSpecialCharsForEdit, "GetSpecialCharsForEdit() not found!" ); +#else + pfunc_getSpecialCharsForEdit = GetSpecialCharsForEdit; +#endif } String aRet; diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 6135f7bfa6e3..08d0352c6b63 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -834,16 +834,28 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) } } +#ifndef DISABLE_SCRIPTING + typedef rtl_uString* (SAL_CALL *basicide_choose_macro)(XModel*, sal_Bool, rtl_uString*); typedef void (SAL_CALL *basicide_macro_organizer)( sal_Int16 ); #define DOSTRING( x ) #x #define STRING( x ) DOSTRING( x ) +#ifndef DISABLE_DYNLOADING + extern "C" { static void SAL_CALL thisModule() {} } +#else + +extern "C" rtl_uString* basicide_choose_macro(XModel*, sal_Bool, rtl_uString*); +extern "C" void basicide_macro_organizer( sal_Int16 ); + +#endif + ::rtl::OUString ChooseMacro( const Reference< XModel >& rxLimitToDocument, sal_Bool bChooseOnly, const ::rtl::OUString& rMacroDesc = ::rtl::OUString() ) { +#ifndef DISABLE_DYNLOADING // get basctl dllname static ::rtl::OUString aLibName( SVLIBRARY( "basctl" ) ); @@ -854,16 +866,24 @@ extern "C" { static void SAL_CALL thisModule() {} } // get symbol ::rtl::OUString aSymbol( "basicide_choose_macro" ); basicide_choose_macro pSymbol = (basicide_choose_macro) osl_getFunctionSymbol( handleMod, aSymbol.pData ); +#else +#define pSymbol basicide_choose_macro +#endif // call basicide_choose_macro in basctl rtl_uString* pScriptURL = pSymbol( rxLimitToDocument.get(), bChooseOnly, rMacroDesc.pData ); ::rtl::OUString aScriptURL( pScriptURL ); rtl_uString_release( pScriptURL ); return aScriptURL; + +#ifdef DISABLE_DYNLOADING +#undef pSymbol +#endif } void MacroOrganizer( sal_Int16 nTabId ) { +#ifndef DISABLE_DYNLOADING // get basctl dllname static ::rtl::OUString aLibName( SVLIBRARY( "basctl" ) ); @@ -874,11 +894,17 @@ void MacroOrganizer( sal_Int16 nTabId ) // get symbol ::rtl::OUString aSymbol( "basicide_macro_organizer" ); basicide_macro_organizer pSymbol = (basicide_macro_organizer) osl_getFunctionSymbol( handleMod, aSymbol.pData ); - // call basicide_macro_organizer in basctl pSymbol( nTabId ); +#else + basicide_macro_organizer( nTabId ); +#endif + } +#endif + + #define RID_ERRBOX_MODULENOTINSTALLED (RID_OFA_START + 72) ResMgr* SfxApplication::GetOffResManager_Impl() @@ -890,6 +916,7 @@ ResMgr* SfxApplication::GetOffResManager_Impl() namespace { +#ifndef DISABLE_SCRIPTING Window* lcl_getDialogParent( const Reference< XFrame >& _rxFrame, Window* _pFallback ) { if ( !_rxFrame.is() ) @@ -964,6 +991,7 @@ namespace } return NULL; } +#endif // !DISABLE_SCRIPTING } static ::rtl::OUString getConfigurationStringValue( @@ -1076,7 +1104,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) } break; } - +#ifndef DISABLE_SCRIPTING case SID_BASICIDE_APPEAR: { SfxViewFrame* pView = lcl_getBasicIDEViewFrame( NULL ); @@ -1258,6 +1286,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) rReq.Done(); } break; +#endif // !DISABLE_SCRIPTING case SID_OFFICE_CHECK_PLZ: { |