summaryrefslogtreecommitdiff
path: root/sfx2/source/appl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2012-03-05 02:00:40 +0200
committerTor Lillqvist <tml@iki.fi>2012-03-05 02:05:30 +0200
commite42515549eae51fa625b2d8789f20a5065365ac5 (patch)
tree2af9385edcdd9a87361f8869349c6f4f57f82119 /sfx2/source/appl
parentaf9618b29f186c3991d9225cc50b55dc78612f27 (diff)
Sprinkle DISABLE_SCRIPTING ifdefs
Diffstat (limited to 'sfx2/source/appl')
-rw-r--r--sfx2/source/appl/app.cxx34
-rw-r--r--sfx2/source/appl/appbas.cxx36
-rw-r--r--sfx2/source/appl/appbaslib.cxx16
-rw-r--r--sfx2/source/appl/appdata.cxx8
-rw-r--r--sfx2/source/appl/appdde.cxx3
-rw-r--r--sfx2/source/appl/appquit.cxx5
-rw-r--r--sfx2/source/appl/appserv.cxx6
-rw-r--r--sfx2/source/appl/appuno.cxx7
8 files changed, 113 insertions, 2 deletions
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index 231a2570c613..e792eea8e923 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -140,7 +140,9 @@ using namespace ::com::sun::star;
// Static member
SfxApplication* SfxApplication::pApp = NULL;
+#ifndef DISABLE_SCRIPTING
static BasicDLL* pBasic = NULL;
+#endif
static SfxHelp* pSfxHelp = NULL;
namespace
@@ -223,8 +225,10 @@ SfxApplication::SfxApplication()
pSfxHelp = new SfxHelp;
+#ifndef DISABLE_SCRIPTING
pBasic = new BasicDLL;
StarBASIC::SetGlobalErrorHdl( LINK( this, SfxApplication, GlobalBasicErrorHdl_Impl ) );
+#endif
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} initialize DDE" );
}
@@ -241,8 +245,9 @@ SfxApplication::~SfxApplication()
// delete global options
SvtViewOptions::ReleaseOptions();
+#ifndef DISABLE_SCRIPTING
delete pBasic;
-
+#endif
if ( !pAppData_Impl->bDowning )
Deinitialize();
@@ -482,14 +487,22 @@ void SfxApplication::Invalidate( sal_uInt16 nId )
#define DOSTRING( x ) #x
#define STRING( x ) DOSTRING( x )
+#ifndef DISABLE_SCRIPTING
+
typedef long (SAL_CALL *basicide_handle_basic_error)(void*);
typedef rtl_uString* (SAL_CALL *basicide_choose_macro)(void*, sal_Bool, rtl_uString*);
typedef void* (SAL_CALL *basicide_macro_organizer)(sal_Int16);
extern "C" { static void SAL_CALL thisModule() {} }
+#endif
+
IMPL_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC*, pStarBasic )
{
+#ifdef DISABLE_SCRIPTING
+ (void) pStarBasic;
+ return 0;
+#else
// get basctl dllname
static ::rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "basctl" ) ) );
@@ -505,12 +518,16 @@ IMPL_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC*, pStarBasic )
long nRet = pSymbol ? pSymbol( pStarBasic ) : 0;
return nRet;
+#endif
}
sal_Bool SfxApplication::IsXScriptURL( const String& rScriptURL )
{
sal_Bool result = sal_False;
+#ifdef DISABLE_SCRIPTING
+ (void) rScriptURL;
+#else
::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory > xSMgr =
::comphelper::getProcessServiceFactory();
@@ -541,6 +558,7 @@ sal_Bool SfxApplication::IsXScriptURL( const String& rScriptURL )
// ignore, will just return FALSE
}
}
+#endif
return result;
}
@@ -549,6 +567,7 @@ SfxApplication::ChooseScript()
{
::rtl::OUString aScriptURL;
+#ifndef DISABLE_SCRIPTING
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
if ( pFact )
{
@@ -574,11 +593,15 @@ SfxApplication::ChooseScript()
delete pDlg;
}
+#endif
return aScriptURL;
}
void SfxApplication::MacroOrganizer( sal_Int16 nTabId )
{
+#ifdef DISABLE_SCRIPTING
+ (void) nTabId;
+#else
// get basctl dllname
static ::rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "basctl" ) ) );
@@ -592,11 +615,20 @@ void SfxApplication::MacroOrganizer( sal_Int16 nTabId )
// call basicide_choose_macro in basctl
pSymbol( nTabId );
+#endif
}
ErrCode SfxApplication::CallBasic( const String& rCode, BasicManager* pMgr, SbxArray* pArgs, SbxValue* pRet )
{
+#ifdef DISABLE_SCRIPTING
+ (void) rCode;
+ (void) pMgr;
+ (void) pArgs;
+ (void) pRet;
+ return ERRCODE_BASIC_CANNOT_LOAD;
+#else
return pMgr->ExecuteMacro( rCode, pArgs, pRet);
+#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx
index 12ef3f0226da..0018663e83e8 100644
--- a/sfx2/source/appl/appbas.cxx
+++ b/sfx2/source/appl/appbas.cxx
@@ -138,48 +138,79 @@ sal_uInt16 SfxApplication::SaveBasicAndDialogContainer() const
SbxVariable* MakeVariable( StarBASIC *pBas, SbxObject *pObject,
const char *pName, sal_uInt32 nSID, SbxDataType eType, SbxClassType eClassType )
{
+#ifdef DISABLE_SCRIPTING
+ (void) pBas;
+ (void) pObject;
+ (void) pName;
+ (void) nSID;
+ (void) eType;
+ (void) eClassType;
+ return 0;
+#else
SbxVariable *pVar = pBas->Make( String::CreateFromAscii(pName), eClassType, eType ); //SbxCLASS_PROPERTY
pVar->SetUserData( nSID );
pVar->SetFlag( SBX_DONTSTORE );
pObject->StartListening( pVar->GetBroadcaster() );
return pVar;
+#endif
}
//--------------------------------------------------------------------
BasicManager* SfxApplication::GetBasicManager()
{
+#ifdef DISABLE_SCRIPTING
+ return 0;
+#else
return BasicManagerRepository::getApplicationBasicManager( true );
+#endif
}
//--------------------------------------------------------------------
Reference< XLibraryContainer > SfxApplication::GetDialogContainer()
{
+#ifdef DISABLE_SCRIPTING
+ Reference< XLibraryContainer > dummy;
+ return dummy;
+#else
if ( !pAppData_Impl->pBasicManager->isValid() )
GetBasicManager();
return pAppData_Impl->pBasicManager->getLibraryContainer( SfxBasicManagerHolder::DIALOGS );
+#endif
}
//--------------------------------------------------------------------
Reference< XLibraryContainer > SfxApplication::GetBasicContainer()
{
+#ifdef DISABLE_SCRIPTING
+ Reference< XLibraryContainer > dummy;
+ return dummy;
+#else
if ( !pAppData_Impl->pBasicManager->isValid() )
GetBasicManager();
return pAppData_Impl->pBasicManager->getLibraryContainer( SfxBasicManagerHolder::SCRIPTS );
+#endif
}
//--------------------------------------------------------------------
StarBASIC* SfxApplication::GetBasic()
{
+#ifdef DISABLE_SCRIPTING
+ return 0;
+#else
return GetBasicManager()->GetLib(0);
+#endif
}
//-------------------------------------------------------------------------
void SfxApplication::PropExec_Impl( SfxRequest &rReq )
{
+#ifdef DISABLE_SCRIPTING
+ (void) rReq;
+#else
rReq.GetArgs();
sal_uInt16 nSID = rReq.GetSlot();
switch ( nSID )
@@ -244,11 +275,15 @@ void SfxApplication::PropExec_Impl( SfxRequest &rReq )
break;
}
}
+#endif
}
//-------------------------------------------------------------------------
void SfxApplication::PropState_Impl( SfxItemSet &rSet )
{
+#ifdef DISABLE_SCRIPTING
+ (void) rSet;
+#else
SfxWhichIter aIter(rSet);
for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
{
@@ -288,6 +323,7 @@ void SfxApplication::PropState_Impl( SfxItemSet &rSet )
}
}
}
+#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx
index a5b6e337ff6e..a8fb71ed2e6e 100644
--- a/sfx2/source/appl/appbaslib.cxx
+++ b/sfx2/source/appl/appbaslib.cxx
@@ -55,6 +55,7 @@ void SfxBasicManagerHolder::reset( BasicManager* _pBasicManager )
{
impl_releaseContainers();
+#ifndef DISABLE_SCRIPTING
// Note: we do not delete the old BasicManager. BasicManager instances are
// nowadays obtained from the BasicManagerRepository, and the ownership is with
// the repository.
@@ -74,10 +75,12 @@ void SfxBasicManagerHolder::reset( BasicManager* _pBasicManager )
DBG_UNHANDLED_EXCEPTION();
}
}
+#endif
}
void SfxBasicManagerHolder::storeAllLibraries()
{
+#ifndef DISABLE_SCRIPTING
OSL_PRECOND( isValid(), "SfxBasicManagerHolder::storeAllLibraries: not initialized!" );
try
{
@@ -90,10 +93,14 @@ void SfxBasicManagerHolder::storeAllLibraries()
{
DBG_UNHANDLED_EXCEPTION();
}
+#endif
}
void SfxBasicManagerHolder::setStorage( const Reference< XStorage >& _rxStorage )
{
+#ifdef DISABLE_SCRIPTING
+ (void) _rxStorage;
+#else
try
{
if ( mxBasicContainer.is() )
@@ -105,16 +112,21 @@ void SfxBasicManagerHolder::setStorage( const Reference< XStorage >& _rxStorage
{
DBG_UNHANDLED_EXCEPTION();
}
+#endif
}
void SfxBasicManagerHolder::storeLibrariesToStorage( const Reference< XStorage >& _rxStorage )
{
+#ifdef DISABLE_SCRIPTING
+ (void) _rxStorage;
+#else
OSL_PRECOND( isValid(), "SfxBasicManagerHolder::storeLibrariesToStorage: not initialized!" );
if ( mxBasicContainer.is() )
mxBasicContainer->storeLibrariesToStorage( _rxStorage );
if ( mxDialogContainer.is() )
mxDialogContainer->storeLibrariesToStorage( _rxStorage );
+#endif
}
Reference< XLibraryContainer > SfxBasicManagerHolder::getLibraryContainer( ContainerType _eType )
@@ -139,8 +151,12 @@ void SfxBasicManagerHolder::impl_releaseContainers()
sal_Bool
SfxBasicManagerHolder::LegacyPsswdBinaryLimitExceeded( Sequence< rtl::OUString >& sModules )
{
+#ifdef DISABLE_SCRIPTING
+ (void) sModules;
+#else
if ( mpBasicManager )
return mpBasicManager->LegacyPsswdBinaryLimitExceeded( sModules );
+#endif
return sal_True;
}
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index 0358dd4a19c6..a5904eb7fc8f 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -132,7 +132,9 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* )
, bODFVersionWarningLater( sal_False )
{
+#ifndef DISABLE_SCRIPTING
BasicManagerRepository::registerCreationListener( *pBasMgrListener );
+#endif
}
SfxAppData_Impl::~SfxAppData_Impl()
@@ -141,8 +143,10 @@ SfxAppData_Impl::~SfxAppData_Impl()
delete pTopFrames;
delete pBasicManager;
+#ifndef DISABLE_SCRIPTING
BasicManagerRepository::revokeCreationListener( *pBasMgrListener );
delete pBasMgrListener;
+#endif
}
SfxDocumentTemplates* SfxAppData_Impl::GetDocumentTemplates()
@@ -156,12 +160,16 @@ SfxDocumentTemplates* SfxAppData_Impl::GetDocumentTemplates()
void SfxAppData_Impl::OnApplicationBasicManagerCreated( BasicManager& _rBasicManager )
{
+#ifdef DISABLE_SCRIPTING
+ (void) _rBasicManager;
+#else
pBasicManager->reset( &_rBasicManager );
// global constants, additionally to the ones already added by createApplicationBasicManager:
// ThisComponent
Reference< XInterface > xCurrentComponent = SfxObjectShell::GetCurrentComponent();
_rBasicManager.SetGlobalUNOConstant( "ThisComponent", makeAny( xCurrentComponent ) );
+#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx
index 65be1fcb6120..d46a016cb2c0 100644
--- a/sfx2/source/appl/appdde.cxx
+++ b/sfx2/source/appl/appdde.cxx
@@ -350,6 +350,7 @@ long SfxObjectShell::DdeExecute
*/
{
+#ifndef DISABLE_SCRIPTING
StarBASIC* pBasic = GetBasic();
DBG_ASSERT( pBasic, "Where is the Basic???" ) ;
SbxVariable* pRet = pBasic->Execute( rCmd );
@@ -358,7 +359,7 @@ long SfxObjectShell::DdeExecute
SbxBase::ResetError();
return 0;
}
-
+#endif
return 1;
}
diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx
index f5a8f59a325d..b78b30e6e0ac 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -90,6 +90,7 @@ void SfxApplication::Deinitialize()
if ( pAppData_Impl->bDowning )
return;
+#ifndef DISABLE_SCRIPTING
StarBASIC::Stop();
// Save BASIC if possible
@@ -98,6 +99,7 @@ void SfxApplication::Deinitialize()
SaveBasicManager();
SaveBasicAndDialogContainer();
+#endif
pAppData_Impl->bDowning = sal_True; // due to Timer from DecAliveCount and QueryExit
@@ -122,9 +124,12 @@ void SfxApplication::Deinitialize()
// Release Controller and others
// then the remaining components should alse disapear ( Beamer! )
+
+#ifndef DISABLE_SCRIPTING
BasicManagerRepository::resetApplicationBasicManager();
pAppData_Impl->pBasicManager->reset( NULL );
// this will also delete pBasMgr
+#endif
DBG_ASSERT( pAppData_Impl->pViewFrame == 0, "active foreign ViewFrame" );
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 8070b51d455b..24e818800188 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -532,6 +532,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
break;
}
+#ifndef DISABLE_SCRIPTING
case SID_BASICSTOP:
StarBASIC::Stop();
break;
@@ -539,6 +540,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_BASICBREAK :
BASIC_DLL()->BasicBreak();
break;
+#endif
case SID_CRASH :
{
@@ -666,10 +668,12 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
break;
}
+#ifndef DISABLE_SCRIPTING
case SID_BASICSTOP:
if ( !StarBASIC::IsRunning() )
rSet.DisableItem(nWhich);
break;
+#endif
case SID_HELPTIPS:
{
@@ -1174,8 +1178,10 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
String aPLZ = pStringItem->GetValue();
bRet = sal_True /*!!!SfxIniManager::CheckPLZ( aPLZ )*/;
}
+#ifndef DISABLE_SCRIPTING
else
SbxBase::SetError( SbxERR_WRONG_ARGS );
+#endif
rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bRet ) );
}
break;
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 6026f19a4580..fe9e65a082a9 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -1766,6 +1766,12 @@ void SAL_CALL SfxMacroLoader::removeStatusListener(
ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star::uno::Any& rRetval, SfxObjectShell* pSh )
throw ( ::com::sun::star::uno::RuntimeException )
{
+#ifdef DISABLE_SCRIPTING
+ (void) rURL;
+ (void) rRetval;
+ (void) pSh;
+ return ERRCODE_BASIC_PROC_UNDEFINED;
+#else
SfxObjectShell* pCurrent = pSh;
if ( !pCurrent )
// all not full qualified names use the BASIC of the given or current document
@@ -1905,6 +1911,7 @@ ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star::
SbxBase::ResetError();
return nErr;
+#endif
}
SFX_IMPL_XSERVICEINFO( SfxAppDispatchProvider, "com.sun.star.frame.DispatchProvider", "com.sun.star.comp.sfx2.AppDispatchProvider" ) \