diff options
author | Tor Lillqvist <tml@iki.fi> | 2012-03-05 21:41:31 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2012-03-05 22:30:12 +0200 |
commit | b344c30ab49b6faf8a24be42bdfcf4e946a861cd (patch) | |
tree | 75699c0eb98676e6f9359a44fae78a29594ad751 | |
parent | b69285590d704b08852c22dbb5ed073bff9998ce (diff) |
Sprinkle more DISABLE_SCRIPTING ifdefs
24 files changed, 320 insertions, 150 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index efcf67ffd5cd..28ce80fa4ea8 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -120,6 +120,8 @@ SbxVariable* getDefaultProp( SbxVariable* pRef ); #undef GradientSyle_RECT #endif +#ifndef DISABLE_SCRIPTING + // from source/classes/sbxmod.cxx Reference< XModel > getDocumentModel( StarBASIC* ); @@ -143,20 +145,7 @@ static void FilterWhiteSpace( String& rStr ) rStr = aRet.makeStringAndClear(); } -static long GetDayDiff( const Date& rDate ) -{ - Date aRefDate( 1,1,1900 ); - long nDiffDays; - if ( aRefDate > rDate ) - { - nDiffDays = (long)(aRefDate - rDate); - nDiffDays *= -1; - } - else - nDiffDays = (long)(rDate - aRefDate); - nDiffDays += 2; // adjustment VisualBasic: 1.Jan.1900 == 2 - return nDiffDays; -} +static long GetDayDiff( const Date& rDate ); static const CharClass& GetCharClass( void ) { @@ -1761,68 +1750,7 @@ sal_Int16 implGetDateMonth( double aDate ) return nRet; } -sal_Int16 implGetDateYear( double aDate ) -{ - Date aRefDate( 1,1,1900 ); - long nDays = (long) aDate; - nDays -= 2; // standardize: 1.1.1900 => 0.0 - aRefDate += nDays; - sal_Int16 nRet = (sal_Int16)( aRefDate.GetYear() ); - return nRet; -} - -sal_Bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet ) -{ - if ( nYear < 30 && SbiRuntime::isVBAEnabled() ) - nYear += 2000; - else if ( nYear < 100 ) - nYear += 1900; - Date aCurDate( nDay, nMonth, nYear ); - if ((nYear < 100 || nYear > 9999) ) - { - StarBASIC::Error( SbERR_BAD_ARGUMENT ); - return sal_False; - } - if ( !SbiRuntime::isVBAEnabled() ) - { - if ( (nMonth < 1 || nMonth > 12 )|| - (nDay < 1 || nDay > 31 ) ) - { - StarBASIC::Error( SbERR_BAD_ARGUMENT ); - return sal_False; - } - } - else - { - // grab the year & month - aCurDate = Date( 1, (( nMonth % 12 ) > 0 ) ? ( nMonth % 12 ) : 12 + ( nMonth % 12 ), nYear ); - - // adjust year based on month value - // e.g. 2000, 0, xx = 1999, 12, xx ( or December of the previous year ) - // 2000, 13, xx = 2001, 1, xx ( or January of the following year ) - if( ( nMonth < 1 ) || ( nMonth > 12 ) ) - { - // inacurrate around leap year, don't use days to calculate, - // just modify the months directory - sal_Int16 nYearAdj = ( nMonth /12 ); // default to positive months inputed - if ( nMonth <=0 ) - nYearAdj = ( ( nMonth -12 ) / 12 ); - aCurDate.SetYear( aCurDate.GetYear() + nYearAdj ); - } - - // adjust day value, - // e.g. 2000, 2, 0 = 2000, 1, 31 or the last day of the previous month - // 2000, 1, 32 = 2000, 2, 1 or the first day of the following month - if( ( nDay < 1 ) || ( nDay > aCurDate.GetDaysInMonth() ) ) - aCurDate += nDay - 1; - else - aCurDate.SetDay( nDay ); - } - - long nDiffDays = GetDayDiff( aCurDate ); - rdRet = (double)nDiffDays; - return sal_True; -} +sal_Int16 implGetDateYear( double aDate ); // Function to convert date to ISO 8601 date format RTLFUNC(CDateToIso) @@ -2077,17 +2005,7 @@ RTLFUNC(Hour) } } -sal_Int16 implGetMinute( double dDate ) -{ - if( dDate < 0.0 ) - dDate *= -1.0; - double nFrac = dDate - floor( dDate ); - nFrac *= 86400.0; - sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5); - sal_Int16 nTemp = (sal_Int16)(nSeconds % 3600); - sal_Int16 nMin = nTemp / 60; - return nMin; -} +sal_Int16 implGetMinute( double dDate ); RTLFUNC(Minute) { @@ -4428,4 +4346,108 @@ RTLFUNC(Partition) rPar.Get(0)->PutString( String(aRetStr.makeStringAndClear()) ); } +#endif + +static long GetDayDiff( const Date& rDate ) +{ + Date aRefDate( 1,1,1900 ); + long nDiffDays; + if ( aRefDate > rDate ) + { + nDiffDays = (long)(aRefDate - rDate); + nDiffDays *= -1; + } + else + nDiffDays = (long)(rDate - aRefDate); + nDiffDays += 2; // adjustment VisualBasic: 1.Jan.1900 == 2 + return nDiffDays; +} + +sal_Int16 implGetDateYear( double aDate ) +{ + Date aRefDate( 1,1,1900 ); + long nDays = (long) aDate; + nDays -= 2; // standardize: 1.1.1900 => 0.0 + aRefDate += nDays; + sal_Int16 nRet = (sal_Int16)( aRefDate.GetYear() ); + return nRet; +} + +sal_Bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet ) +{ +#ifndef DISABLE_SCRIPTING + if ( nYear < 30 && SbiRuntime::isVBAEnabled() ) + nYear += 2000; + else +#endif + if ( nYear < 100 ) + nYear += 1900; + Date aCurDate( nDay, nMonth, nYear ); + if ((nYear < 100 || nYear > 9999) ) + { +#ifndef DISABLE_SCRIPTING + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +#endif + return sal_False; + } + +#ifndef DISABLE_SCRIPTING + if ( !SbiRuntime::isVBAEnabled() ) +#endif + { + if ( (nMonth < 1 || nMonth > 12 )|| + (nDay < 1 || nDay > 31 ) ) + { +#ifndef DISABLE_SCRIPTING + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +#endif + return sal_False; + } + } +#ifndef DISABLE_SCRIPTING + else + { + // grab the year & month + aCurDate = Date( 1, (( nMonth % 12 ) > 0 ) ? ( nMonth % 12 ) : 12 + ( nMonth % 12 ), nYear ); + + // adjust year based on month value + // e.g. 2000, 0, xx = 1999, 12, xx ( or December of the previous year ) + // 2000, 13, xx = 2001, 1, xx ( or January of the following year ) + if( ( nMonth < 1 ) || ( nMonth > 12 ) ) + { + // inacurrate around leap year, don't use days to calculate, + // just modify the months directory + sal_Int16 nYearAdj = ( nMonth /12 ); // default to positive months inputed + if ( nMonth <=0 ) + nYearAdj = ( ( nMonth -12 ) / 12 ); + aCurDate.SetYear( aCurDate.GetYear() + nYearAdj ); + } + + // adjust day value, + // e.g. 2000, 2, 0 = 2000, 1, 31 or the last day of the previous month + // 2000, 1, 32 = 2000, 2, 1 or the first day of the following month + if( ( nDay < 1 ) || ( nDay > aCurDate.GetDaysInMonth() ) ) + aCurDate += nDay - 1; + else + aCurDate.SetDay( nDay ); + } +#endif + + long nDiffDays = GetDayDiff( aCurDate ); + rdRet = (double)nDiffDays; + return sal_True; +} + +sal_Int16 implGetMinute( double dDate ) +{ + if( dDate < 0.0 ) + dDate *= -1.0; + double nFrac = dDate - floor( dDate ); + nFrac *= 86400.0; + sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5); + sal_Int16 nTemp = (sal_Int16)(nSeconds % 3600); + sal_Int16 nMin = nTemp / 60; + return nMin; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 04a21d59af73..91c739f84f33 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -107,6 +107,8 @@ static Reference< XCalendar3 > getLocaleCalendar( void ) return xCalendar; } +#ifndef DISABLE_SCRIPTING + RTLFUNC(CallByName) { (void)pBasic; @@ -1835,42 +1837,6 @@ RTLFUNC(WeekdayName) rPar.Get(0)->PutString( String(aRetStr) ); } -sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 nFirstDay = 0 ) -{ - Date aRefDate( 1,1,1900 ); - long nDays = (long) aDate; - nDays -= 2; // normieren: 1.1.1900 => 0 - aRefDate += nDays; - DayOfWeek aDay = aRefDate.GetDayOfWeek(); - sal_Int16 nDay; - if ( aDay != SUNDAY ) - nDay = (sal_Int16)aDay + 2; - else - nDay = 1; // 1 == Sunday - - // #117253 optional 2nd parameter "firstdayofweek" - if( bFirstDayParam ) - { - if( nFirstDay < 0 || nFirstDay > 7 ) - { - StarBASIC::Error( SbERR_BAD_ARGUMENT ); - return 0; - } - if( nFirstDay == 0 ) - { - Reference< XCalendar3 > xCalendar = getLocaleCalendar(); - if( !xCalendar.is() ) - { - StarBASIC::Error( SbERR_INTERNAL_ERROR ); - return 0; - } - nFirstDay = sal_Int16( xCalendar->getFirstDayOfWeek() + 1 ); - } - nDay = 1 + (nDay + 7 - nFirstDay) % 7; - } - return nDay; -} - RTLFUNC(Weekday) { (void)pBasic; @@ -3242,4 +3208,46 @@ RTLFUNC(Me) refVar->PutObject( pClassModuleObject ); } +#endif + +sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 nFirstDay = 0 ) +{ + Date aRefDate( 1,1,1900 ); + long nDays = (long) aDate; + nDays -= 2; // normieren: 1.1.1900 => 0 + aRefDate += nDays; + DayOfWeek aDay = aRefDate.GetDayOfWeek(); + sal_Int16 nDay; + if ( aDay != SUNDAY ) + nDay = (sal_Int16)aDay + 2; + else + nDay = 1; // 1 == Sunday + + // #117253 optional 2nd parameter "firstdayofweek" + if( bFirstDayParam ) + { + if( nFirstDay < 0 || nFirstDay > 7 ) + { +#ifndef DISABLE_SCRIPTING + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +#endif + return 0; + } + if( nFirstDay == 0 ) + { + Reference< XCalendar3 > xCalendar = getLocaleCalendar(); + if( !xCalendar.is() ) + { +#ifndef DISABLE_SCRIPTING + StarBASIC::Error( SbERR_INTERNAL_ERROR ); +#endif + return 0; + } + nFirstDay = sal_Int16( xCalendar->getFirstDayOfWeek() + 1 ); + } + nDay = 1 + (nDay + 7 - nFirstDay) % 7; + } + return nDay; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx index 544f71708da0..d221e4d85288 100644 --- a/basic/source/sbx/sbxarray.cxx +++ b/basic/source/sbx/sbxarray.cxx @@ -767,10 +767,12 @@ void SbxDimArray::Put32( SbxVariable* p, const sal_Int32* pIdx ) sal_uInt32 SbxDimArray::Offset32( SbxArray* pPar ) { +#ifndef DISABLE_SCRIPTING if( nDim == 0 || !pPar || ( ( nDim != ( pPar->Count() - 1 ) ) && SbiRuntime::isVBAEnabled() ) ) { SetError( SbxERR_BOUNDS ); return 0; } +#endif sal_uInt32 nPos = 0; sal_uInt16 nOff = 1; // Non element 0! for( SbxDim* p = pFirst; p && !IsError(); p = p->pNext ) diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx index ef6a8ae3d185..9eca1dda0e21 100644 --- a/basic/source/sbx/sbxdbl.cxx +++ b/basic/source/sbx/sbxdbl.cxx @@ -78,8 +78,10 @@ double ImpGetDouble( const SbxValues* p ) if( !p->pOUString ) { nRes = 0; +#ifndef DISABLE_SCRIPTING if ( SbiRuntime::isVBAEnabled() )// VBA only behaviour SbxBase::SetError( SbxERR_CONVERSION ); +#endif } else { @@ -88,8 +90,10 @@ double ImpGetDouble( const SbxValues* p ) if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) { nRes = 0; +#ifndef DISABLE_SCRIPTING if ( SbiRuntime::isVBAEnabled() )// VBA only behaviour SbxBase::SetError( SbxERR_CONVERSION ); +#endif } else nRes = d; diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index a25337709e83..b4f111c32f6c 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -219,11 +219,13 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType if( l >= SbxMININT && l <= SbxMAXINT ) eScanType = SbxINTEGER; } +#ifndef DISABLE_SCRIPTING else if ( SbiRuntime::isVBAEnabled() ) { OSL_TRACE("Reporting error converting"); return SbxERR_CONVERSION; } +#endif if( pLen ) *pLen = (sal_uInt16) ( p - pStart ); if( !bRes ) diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx index fc95c5763211..20a7b116793e 100644 --- a/basic/source/sbx/sbxstr.cxx +++ b/basic/source/sbx/sbxstr.cxx @@ -260,7 +260,11 @@ SbxArray* StringToByteArray(const ::rtl::OUString& rStr) sal_Int32 nArraySize = rStr.getLength() * 2; const sal_Unicode* pSrc = rStr.getStr(); SbxDimArray* pArray = new SbxDimArray(SbxBYTE); +#ifdef DISABLE_SCRIPTING + bool bIncIndex = false; +#else bool bIncIndex = ( IsBaseIndexOne() && SbiRuntime::isVBAEnabled() ); +#endif if( nArraySize ) { if( bIncIndex ) diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index be3611921ac1..74b9d9c96a3e 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -297,7 +297,11 @@ SbxValue* SbxValue::TheRealValue( sal_Bool bObjInObjError ) const ((SbxValue*) pObj)->aData.eType == SbxOBJECT && ((SbxValue*) pObj)->aData.pObj == pObj ) { +#ifdef DISABLE_SCRIPTING // No sbunoobj + const bool bSuccess = false; +#else bool bSuccess = handleToStringForCOMObjects( pObj, p ); +#endif if( !bSuccess ) { SetError( SbxERR_BAD_PROP_VALUE ); @@ -914,8 +918,11 @@ sal_Bool SbxValue::Convert( SbxDataType eTo ) sal_Bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) { +#ifdef DISABLE_SCRIPTING + bool bVBAInterop = false; +#else bool bVBAInterop = SbiRuntime::isVBAEnabled(); - +#endif SbxDataType eThisType = GetType(); SbxDataType eOpType = rOp.GetType(); SbxError eOld = GetError(); @@ -1283,7 +1290,11 @@ Lbl_OpIsEmpty: sal_Bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const { +#ifdef DISABLE_SCRIPTING + bool bVBAInterop = false; +#else bool bVBAInterop = SbiRuntime::isVBAEnabled(); +#endif sal_Bool bRes = sal_False; SbxError eOld = GetError(); diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index d00115a1ed41..9ad7a5f0de9d 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -93,8 +93,10 @@ SbxVariable::SbxVariable( const SbxVariable& r ) if( r.mpSbxVariableImpl != NULL ) { mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl ); +#ifndef DISABLE_SCRIPTING if( mpSbxVariableImpl->m_xComListener.is() ) registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic ); +#endif } pCst = NULL; if( r.CanRead() ) @@ -141,8 +143,10 @@ SbxVariable::~SbxVariable() if ( maName.EqualsAscii( aCellsStr ) ) maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 ); #endif +#ifndef DISABLE_SCRIPTING if( IsSet( SBX_DIM_AS_NEW )) removeDimAsNewRecoverItem( this ); +#endif delete mpSbxVariableImpl; delete pCst; } @@ -333,8 +337,10 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r ) if( r.mpSbxVariableImpl != NULL ) { mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl ); +#ifndef DISABLE_SCRIPTING if( mpSbxVariableImpl->m_xComListener.is() ) registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic ); +#endif } else mpSbxVariableImpl = NULL; @@ -422,7 +428,9 @@ void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun:: SbxVariableImpl* pImpl = getImpl(); pImpl->m_xComListener = xComListener; pImpl->m_pComListenerParentBasic = pParentBasic; +#ifndef DISABLE_SCRIPTING registerComListenerVariableForBasic( this, pParentBasic ); +#endif } void SbxVariable::ClearComListener( void ) diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index cac2b87229ce..74e5fc272e8e 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -185,7 +185,10 @@ ODatabaseContext::ODatabaseContext( const Reference< XComponentContext >& _rxCon ,m_aContainerListeners(m_aMutex) { m_pDatabaseDocumentLoader = new DatabaseDocumentLoader( m_aContext ); + +#ifndef DISABLE_SCRIPTING ::basic::BasicManagerRepository::registerCreationListener( *this ); +#endif osl_incrementInterlockedCount( &m_refCount ); { @@ -199,7 +202,10 @@ ODatabaseContext::ODatabaseContext( const Reference< XComponentContext >& _rxCon ODatabaseContext::~ODatabaseContext() { +#ifndef DISABLE_SCRIPTING ::basic::BasicManagerRepository::revokeCreationListener( *this ); +#endif + if ( m_pDatabaseDocumentLoader ) m_pDatabaseDocumentLoader->release(); @@ -749,6 +755,10 @@ Sequence< sal_Int8 > ODatabaseContext::getUnoTunnelImplementationId() void ODatabaseContext::onBasicManagerCreated( const Reference< XModel >& _rxForDocument, BasicManager& _rBasicManager ) { +#ifdef DISABLE_SCRIPTING + (void) _rxForDocument; + (void) _rBasicManager; +#else // if it's a database document ... Reference< XOfficeDatabaseDocument > xDatabaseDocument( _rxForDocument, UNO_QUERY ); // ... or a sub document of a database document ... @@ -762,6 +772,7 @@ void ODatabaseContext::onBasicManagerCreated( const Reference< XModel >& _rxForD // ... whose BasicManager has just been created, then add the global DatabaseDocument variable to its scope. if ( xDatabaseDocument.is() ) _rBasicManager.SetGlobalUNOConstant( "ThisDatabaseDocument", makeAny( xDatabaseDocument ) ); +#endif } } // namespace dbaccess diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 4c7d3f9804e7..b7071580f2a2 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -181,6 +181,13 @@ SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath ) bool hasMacro( SfxObjectShell* pShell, const String& sLibrary, String& sMod, const String& sMacro ) { bool bFound = false; + +#ifdef DISABLE_SCRIPTING + (void) pShell; + (void) sLibrary; + (void) sMod; + (void) sMacro; +#else if ( sLibrary.Len() && sMacro.Len() ) { OSL_TRACE("** Searching for %s.%s in library %s" @@ -228,6 +235,7 @@ bool hasMacro( SfxObjectShell* pShell, const String& sLibrary, String& sMod, con } } } +#endif return bFound; } @@ -266,6 +274,12 @@ void parseMacro( const rtl::OUString& sMacro, String& sContainer, String& sModul ::rtl::OUString resolveVBAMacro( SfxObjectShell* pShell, const ::rtl::OUString& rLibName, const ::rtl::OUString& rModuleName, const ::rtl::OUString& rMacroName ) { +#ifdef DISABLE_SCRIPTING + (void) pShell; + (void) rLibName; + (void) rModuleName; + (void) rMacroName; +#else if( pShell ) { ::rtl::OUString aLibName = rLibName.isEmpty() ? getDefaultProjectName( pShell ) : rLibName ; @@ -273,11 +287,19 @@ void parseMacro( const rtl::OUString& sMacro, String& sContainer, String& sModul if( hasMacro( pShell, aLibName, aModuleName, rMacroName ) ) return ::rtl::OUStringBuffer( aLibName ).append( sal_Unicode( '.' ) ).append( aModuleName ).append( sal_Unicode( '.' ) ).append( rMacroName ).makeStringAndClear(); } +#endif return ::rtl::OUString(); } MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& MacroName, bool bSearchGlobalTemplates ) { +#ifdef DISABLE_SCRIPTING + (void) pShell; + (void) MacroName; + (void) bSearchGlobalTemplates; + + return MacroResolvedInfo(); +#else if( !pShell ) return MacroResolvedInfo(); @@ -439,11 +461,20 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& aRes.msResolvedMacro = sProcedure.Insert( '.', 0 ).Insert( sModule, 0).Insert( '.', 0 ).Insert( sContainer, 0 ); return aRes; +#endif } // Treat the args as possible inouts ( convertion at bottom of method ) sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet, const uno::Any& /*aCaller*/) { +#ifdef DISABLE_SCRIPTING + (void) pShell; + (void) sMacroName; + (void) aArgs; + (void) aRet; + + return sal_False; +#else sal_Bool bRes = sal_False; if ( !pShell ) return bRes; @@ -476,6 +507,7 @@ sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Se bRes = sal_False; } return bRes; +#endif } // ============================================================================ diff --git a/filter/source/msfilter/svxmsbas2.cxx b/filter/source/msfilter/svxmsbas2.cxx index 6e3969d3543b..5058c17afc78 100644 --- a/filter/source/msfilter/svxmsbas2.cxx +++ b/filter/source/msfilter/svxmsbas2.cxx @@ -47,10 +47,11 @@ sal_uLong SvxImportMSVBasic::SaveOrDelMSVBAStorage( sal_Bool bSaveInto, xVBAStg = 0; if( bSaveInto ) { +#ifndef DISABLE_SCRIPTING BasicManager *pBasicMan = rDocSh.GetBasicManager(); if( pBasicMan && pBasicMan->IsBasicModified() ) nRet = ERRCODE_SVX_MODIFIED_VBASIC_STORAGE; - +#endif SotStorageRef xSrc = SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName, STREAM_STD_READ ); SotStorageRef xDst = xRoot->OpenSotStorage( rStorageName, STREAM_READWRITE | STREAM_TRUNC ); xSrc->CopyTo( xDst ); diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index bc8b3bae51e4..3bc8dc1c8659 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -693,9 +693,11 @@ void SAL_CALL SlideshowImpl::disposing() if( maPresSettings.mbFullScreen ) { +#ifndef DISABLE_SCRIPTING // restore StarBASICErrorHdl StarBASIC::SetGlobalErrorHdl(maStarBASICGlobalErrorHdl); maStarBASICGlobalErrorHdl = Link(); +#endif } else { @@ -1038,9 +1040,11 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings ) if( maPresSettings.mbFullScreen ) { +#ifndef DISABLE_SCRIPTING // disable basic ide error handling maStarBASICGlobalErrorHdl = StarBASIC::GetGlobalErrorHdl(); StarBASIC::SetGlobalErrorHdl( Link() ); +#endif } // call resize handler diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index c83267ef5131..e0e075088320 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -177,7 +177,9 @@ void ViewShell::Implementation::ProcessModifyPageSlot ( } else { +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); +#endif rRequest.Ignore (); break; } @@ -189,7 +191,9 @@ void ViewShell::Implementation::ProcessModifyPageSlot ( } else { +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif rRequest.Ignore (); break; } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index ee16ce6c2760..af8239ffcb88 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -492,8 +492,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) rReq.Ignore (); break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif rReq.Ignore (); break; } @@ -519,8 +520,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) rReq.Ignore (); break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif rReq.Ignore (); break; } @@ -567,13 +569,15 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) rBindings.Invalidate( SID_ZOOM_OUT ); rBindings.Invalidate( SID_ATTR_ZOOMSLIDER ); } +#ifndef DISABLE_SCRIPTING else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); - +#endif rReq.Ignore (); break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif rReq.Ignore (); break; } diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index eb7d96799c25..f67f60fac66a 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -174,7 +174,9 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) sal_Int32 nWhatKind = (sal_Int32)pWhatKind->GetValue (); if (! CHECK_RANGE (PK_STANDARD, nWhatKind, PK_HANDOUT)) { +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); +#endif rReq.Ignore (); break; } @@ -182,7 +184,9 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) { if (! CHECK_RANGE (0, nWhatPage, GetDoc()->GetSdPageCount((PageKind)nWhatKind))) { +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); +#endif rReq.Ignore (); break; } @@ -193,7 +197,9 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) } else { +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif rReq.Ignore (); break; } diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx index 107fca660d89..f2741cdf4345 100644 --- a/sd/source/ui/view/drviews9.cxx +++ b/sd/source/ui/view/drviews9.cxx @@ -273,12 +273,14 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) pAttr->Put (XFillStyleItem ((XFillStyle) pFillStyle->GetValue ()), XATTR_FILLSTYLE); rBindings.Invalidate (SID_ATTR_FILL_STYLE); } +#ifndef DISABLE_SCRIPTING else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); - +#endif break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; // linienstil neu bestimmen @@ -293,12 +295,14 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) pAttr->Put (XLineStyleItem ((XLineStyle) pLineStyle->GetValue ()), XATTR_LINESTYLE); rBindings.Invalidate (SID_ATTR_LINE_STYLE); } +#ifndef DISABLE_SCRIPTING else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); - +#endif break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; // linienbreite setzen @@ -312,8 +316,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) rBindings.Invalidate (SID_ATTR_LINE_WIDTH); break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; case SID_SETFILLCOLOR : @@ -335,8 +340,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) rBindings.Invalidate (SID_ATTR_FILL_STYLE); break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; case SID_SETLINECOLOR : @@ -355,8 +361,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) rBindings.Invalidate (SID_ATTR_LINE_COLOR); break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; case SID_SETGRADSTARTCOLOR : @@ -416,8 +423,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) rBindings.Invalidate (SID_ATTR_FILL_GRADIENT); break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; case SID_SETHATCHCOLOR : @@ -469,8 +477,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) rBindings.Invalidate (SID_ATTR_FILL_STYLE); break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; // einstellungen fuer liniendash @@ -513,12 +522,14 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) rBindings.Invalidate (SID_ATTR_LINE_DASH); rBindings.Invalidate (SID_ATTR_FILL_STYLE); } +#ifndef DISABLE_SCRIPTING else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); - +#endif break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; // einstellungen fuer farbverlauf @@ -588,12 +599,14 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) rBindings.Invalidate (SID_ATTR_FILL_GRADIENT); rBindings.Invalidate (SID_ATTR_FILL_STYLE); } +#ifndef DISABLE_SCRIPTING else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); - +#endif break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; // einstellungen fuer schraffur @@ -648,12 +661,14 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) rBindings.Invalidate (SID_ATTR_FILL_HATCH); rBindings.Invalidate (SID_ATTR_FILL_STYLE); } +#ifndef DISABLE_SCRIPTING else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); - +#endif break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; case SID_SELECTGRADIENT : @@ -686,8 +701,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; case SID_SELECTHATCH : @@ -720,8 +736,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; case SID_UNSELECT : @@ -734,8 +751,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) { break; } - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif break; /* case SID_SETFONTFAMILYNAME : diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx index 231c6d54cfe0..516e7b83e16a 100644 --- a/sd/source/ui/view/drviewsb.cxx +++ b/sd/source/ui/view/drviewsb.cxx @@ -164,7 +164,9 @@ void DrawViewShell::FuTemp02(SfxRequest& rReq) } else if (pArgs->Count () != 4) { +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif Cancel(); rReq.Ignore (); break; @@ -340,7 +342,9 @@ void DrawViewShell::FuTemp02(SfxRequest& rReq) } else { +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif Cancel (); rReq.Ignore (); break; diff --git a/sd/source/ui/view/viewshe3.cxx b/sd/source/ui/view/viewshe3.cxx index 674b3443568b..87b88cf73070 100644 --- a/sd/source/ui/view/viewshe3.cxx +++ b/sd/source/ui/view/viewshe3.cxx @@ -300,8 +300,9 @@ SdPage* ViewShell::CreateOrDuplicatePage ( if(HasCurrentFunction( SID_BEZIER_EDIT ) ) GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_BAD_PROP_VALUE); +#endif rRequest.Ignore (); return NULL; } @@ -312,8 +313,9 @@ SdPage* ViewShell::CreateOrDuplicatePage ( if(HasCurrentFunction(SID_BEZIER_EDIT) ) GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); - +#ifndef DISABLE_SCRIPTING StarBASIC::FatalError (SbERR_WRONG_ARGS); +#endif rRequest.Ignore (); return NULL; } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 41fba1651f1d..52c9a70da33f 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -2688,6 +2688,7 @@ void SwDoc::ChkCondColls() uno::Reference< script::vba::XVBAEventProcessor > SwDoc::GetVbaEventProcessor() { +#ifndef DISABLE_SCRIPTING if( !mxVbaEvents.is() && pDocShell && ooo::vba::isAlienWordDoc( *pDocShell ) ) { try @@ -2701,6 +2702,7 @@ SwDoc::GetVbaEventProcessor() { } } +#endif return mxVbaEvents; } diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 3ea75523f9af..f5302fb17038 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -97,6 +97,8 @@ using namespace ::com::sun::star::lang; using rtl::OUString; +#ifndef DISABLE_SCRIPTING + class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery > { SwDocShell* mpDocShell; @@ -260,6 +262,7 @@ public: return sal_True; return sal_False; } + ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { if ( !hasByName( aName ) ) @@ -282,6 +285,8 @@ public: }; +#endif + struct ProvNamesId_Type { const char * pName; @@ -573,12 +578,15 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16 } break; case SW_SERVICE_VBAOBJECTPROVIDER : +#ifndef DISABLE_SCRIPTING { SwVbaObjectForCodeNameProvider* pObjProv = new SwVbaObjectForCodeNameProvider( pDoc->GetDocShell() ); xRet = (cppu::OWeakObject*)pObjProv; } +#endif break; case SW_SERVICE_VBACODENAMEPROVIDER : +#ifndef DISABLE_SCRIPTING { if ( pDoc->GetDocShell() && ooo::vba::isAlienWordDoc( *pDoc->GetDocShell() ) ) { @@ -586,8 +594,10 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16 xRet = (cppu::OWeakObject*)pObjProv; } } +#endif break; case SW_SERVICE_VBAPROJECTNAMEPROVIDER : +#ifndef DISABLE_SCRIPTING { uno::Reference< container::XNameContainer > xProjProv = pDoc->GetVBATemplateToProjectCache(); if ( !xProjProv.is() && pDoc->GetDocShell() && ooo::vba::isAlienWordDoc( *pDoc->GetDocShell() ) ) @@ -598,8 +608,10 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16 //xRet = (cppu::OWeakObject*)xProjProv; xRet = xProjProv; } +#endif break; case SW_SERVICE_VBAGLOBALS : +#ifndef DISABLE_SCRIPTING { if ( pDoc ) { @@ -614,6 +626,7 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16 aGlobs >>= xRet; } } +#endif break; case SW_SERVICE_TYPE_FOOTNOTE : diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 665da0339f82..5fbd867d6d76 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -267,6 +267,7 @@ void SwHTMLParser::InsertBasicDocEvent( rtl::OUString aEvent, const String& rNam void SwHTMLWriter::OutBasic() { +#ifndef DISABLE_SCRIPTING if( !bCfgStarBasic ) return; @@ -319,6 +320,7 @@ void SwHTMLWriter::OutBasic() eDestEnc, &aNonConvertableCharacters ); } } +#endif } static const char* aEventNames[] = diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index f417f3d20328..3b34027c5e65 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4610,10 +4610,12 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) uno::Sequence< uno::Any > aArgs(1); aArgs[ 0 ] <<= mpDocShell->GetModel(); aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( "ooo.vba.word.Globals", aArgs ); + +#ifndef DISABLE_SCRIPTING BasicManager *pBasicMan = mpDocShell->GetBasicManager(); if (pBasicMan) pBasicMan->SetGlobalUNOConstant( "VBAGlobals", aGlobs ); - +#endif BasicProjImportHelper aBasicImporter( *mpDocShell ); // Import vba via oox filter bool bRet = aBasicImporter.import( mpDocShell->GetMedium()->GetInputStream() ); diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 707899b2a961..46cd7092d77f 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -1583,6 +1583,7 @@ void SwDocShell::ReloadFromHtml( const String& rStreamName, SwSrcView* pSrcView // there are some from Meta-Tags dublicated or triplicated afterwards. ClearHeaderAttributesForSourceViewHack(); +#ifndef DISABLE_SCRIPTING // The Document-Basic also bites the dust ... // A EnterBasicCall is not needed here, because nothing is called and // there can't be any Dok-Basic, that has not yet been loaded inside @@ -1623,6 +1624,7 @@ void SwDocShell::ReloadFromHtml( const String& rStreamName, SwSrcView* pSrcView "Deleting Basics didn't work" ); } } +#endif sal_Bool bWasBrowseMode = pDoc->get(IDocumentSettingAccess::BROWSE_MODE); RemoveLink(); diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx index 58917a49e844..504efda20739 100644 --- a/sw/source/ui/shells/frmsh.cxx +++ b/sw/source/ui/shells/frmsh.cxx @@ -1100,7 +1100,9 @@ void SwFrameShell::ExecFrameStyle(SfxRequest& rReq) } //Distance nur setzen, wenn der Request vom Controller kommt +#ifndef DISABLE_SCRIPTING if(!StarBASIC::IsRunning()) +#endif { aNewBox.SetDistance( rBoxItem.GetDistance() ); } |