Hi, Please find attached patches for the conditional removal of legacy calc addins. As always, these changes are made available under LGPLv3+/MPL.
Kohei, I have used a macro definition to conditionally compile the code in/out. In this patch the macro (SC_WITHOUT_LEGACY_ADDIN) is undefined, so the mechanism is left untouched. Defining SC_WITHOUT_LEGACY_ADDIN in global.hxx (both in calc and in binfilter) will remove the legacy addin mechanism. The changes are not optimal from a code point of view, but I've tried to ensure that it is clear what needs to be removed when (and if) the mechanism is finally eliminated. Searching for SC_WITHOUT_LEGACY_ADDIN will find all the pieces of code that should be removed. Regards, Alfonso ----- Original Message ---- From: Kohei Yoshida <kyosh...@novell.com> To: Alfonso Eusebio <alfonso_euse...@yahoo.co.uk> Cc: michael.me...@novell.com Sent: Thu, 17 February, 2011 15:31:03 Subject: Re: [Libreoffice] [PATCH] Remove legacy Addin mechanism from calc On Thu, 2011-02-17 at 13:39 +0000, Alfonso Eusebio wrote: > Hi Michael, > > Don't worry: it was a bit of work, but it was a good exercise as well. > I'm happy to change it to conditionally compiled if you think it's worth it, My preferred approach is indeed to make this code conditionally compiled, and at some point experimentally ship a release without this piece to see how many users complain. ;-) And yes, that would be worth the effort IMO. > The only problem I see is that the version with this piece excluded might > not > get that much testing and hide some issues (I did only limited testing). If we can make that a build time option with --enable-calc-addin (or similar), and then default to on, then we can still test this piece. If you are not too familiar with these autoconf stuff, simply defining a switch somewhere in sc/inc/global.hxx would be fine. Then one of us will work on making that a configure/autogen.sh option. Thanks a lot for looking into this, BTW. Kohei -- Kohei Yoshida, LibreOffice hacker, Calc <kyosh...@novell.com>
From a034cf51de6e1decb36da9b2a07dbdf06d161102 Mon Sep 17 00:00:00 2001 From: Alfonso Eusebio <alfonso_euse...@yahoo.co.uk> Date: Sat, 19 Feb 2011 09:15:23 +0000 Subject: [PATCH] Conditional compilation of legacy addins in calc Introduces conditional compilation of legacy addin mechanism in calc. Controlled through a macro definition in global.hxx --- sc/inc/callform.hxx | 5 +++++ sc/inc/global.hxx | 7 +++++++ sc/source/core/data/documen2.cxx | 6 ++++++ sc/source/core/data/funcdesc.cxx | 10 +++++++++- sc/source/core/data/global.cxx | 17 ++++++++++++++++- sc/source/core/data/globalx.cxx | 9 ++++++--- sc/source/core/inc/addinlis.hxx | 11 +++++++++++ sc/source/core/inc/adiasync.hxx | 5 ++++- sc/source/core/inc/core_pch.hxx | 9 +++++++++ sc/source/core/inc/interpre.hxx | 3 +++ sc/source/core/tool/addinlis.cxx | 5 +++++ sc/source/core/tool/adiasync.cxx | 7 ++----- sc/source/core/tool/callform.cxx | 12 ++++++------ sc/source/core/tool/compiler.cxx | 10 ++++++++++ sc/source/core/tool/interpr4.cxx | 19 ++++++++++++++++--- sc/source/core/tool/parclass.cxx | 12 ++++++++++-- sc/source/ui/unoobj/funcuno.cxx | 7 +++++++ 17 files changed, 132 insertions(+), 22 deletions(-) diff --git a/sc/inc/callform.hxx b/sc/inc/callform.hxx index df22605..4add518 100644 --- a/sc/inc/callform.hxx +++ b/sc/inc/callform.hxx @@ -29,6 +29,9 @@ #ifndef SC_CALLFORM_HXX #define SC_CALLFORM_HXX +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN //Conditionally removes legacy addin + #include "collect.hxx" #include <rtl/ustring.hxx> @@ -125,6 +128,8 @@ public: BOOL InitExternalFunc(const rtl::OUString& rModuleName); void ExitExternalFunc(); +#endif //SC_WITHOUT_LEGACY_ADDIN + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 80e4ccc..3143e42 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -29,6 +29,9 @@ #ifndef SC_SCGLOB_HXX #define SC_SCGLOB_HXX +// Remove comment below to remove legacy addins mechanism +//#define SC_WITHOUT_LEGACY_ADDIN //When defined the legacy addin mechanism is not compiled in + #include "address.hxx" #include <i18npool/lang.h> #include <tools/stream.hxx> @@ -555,7 +558,9 @@ public: SC_DLLPUBLIC static void SetSearchItem( const SvxSearchItem& rNew ); SC_DLLPUBLIC static ScAutoFormat* GetAutoFormat(); static void ClearAutoFormat(); //BugId 54209 +#ifndef SC_WITHOUT_LEGACY_ADDIN static FuncCollection* GetFuncCollection(); +#endif SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection(); SC_DLLPUBLIC static ScUserList* GetUserList(); static void SetUserList( const ScUserList* pNewList ); @@ -582,7 +587,9 @@ public: static long nLastColWidthExtra; static void Init(); // during start up +#ifndef SC_WITHOUT_LEGACY_ADDIN static void InitAddIns(); +#endif static void Clear(); // at the end of the program static void UpdatePPT(OutputDevice* pDev); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 23998d0..22370ce 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -69,7 +69,11 @@ #include "global.hxx" #include "brdcst.hxx" #include "bcaslot.hxx" + +#ifndef SC_WITHOUT_LEGACY_ADDIN #include "adiasync.hxx" +#endif + #include "addinlis.hxx" #include "chartlis.hxx" #include "markdata.hxx" @@ -399,7 +403,9 @@ ScDocument::~ScDocument() // which needs to be stopped before the app closes. pExternalRefMgr.reset(); +#ifndef SC_WITHOUT_LEGACY_ADDIN ScAddInAsync::RemoveDocument( this ); +#endif ScAddInListener::RemoveDocument( this ); DELETEZ( pChartListenerCollection); // vor pBASM wg. evtl. Listener! DELETEZ( pLookupCacheMapImpl); // before pBASM because of listeners diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx index 111c2da..153eaee 100644 --- a/sc/source/core/data/funcdesc.cxx +++ b/sc/source/core/data/funcdesc.cxx @@ -30,7 +30,12 @@ #include "addincol.hxx" #include "appoptio.hxx" + +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN #include "callform.hxx" +#endif + #include "compiler.hxx" #include "global.hxx" #include "sc.hrc" @@ -379,7 +384,6 @@ ScFunctionList::ScFunctionList() : { ScFuncDesc* pDesc = NULL; xub_StrLen nStrLen = 0; - FuncCollection* pFuncColl; ::std::list<ScFuncDesc*> tmpFuncList; sal_uInt16 nDescBlock[] = { @@ -424,6 +428,9 @@ ScFunctionList::ScFunctionList() : sal_uInt16 nNextId = SC_OPCODE_LAST_OPCODE_ID + 1; // FuncID for AddIn functions +#ifndef SC_WITHOUT_LEGACY_ADDIN + FuncCollection* pFuncColl; + // Interpretation of AddIn list ::rtl::OUString aDefArgNameValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")); ::rtl::OUString aDefArgNameString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("string")); @@ -529,6 +536,7 @@ ScFunctionList::ScFunctionList() : if ( nStrLen > nMaxFuncNameLen) nMaxFuncNameLen = nStrLen; } +#endif //SC_WITHOUT_LEGACY_ADDIN // StarOne AddIns diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 9b00b3f..237c33c 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -75,7 +75,11 @@ #include "document.hxx" #include "patattr.hxx" #include "addincol.hxx" + +#ifndef SC_WITHOUT_LEGACY_ADDIN #include "adiasync.hxx" +#endif + #include "userlist.hxx" #include "interpre.hxx" #include "strload.hxx" @@ -103,7 +107,11 @@ using ::rtl::OUStringBuffer; ScDocShellRef* ScGlobal::pDrawClipDocShellRef = NULL; SvxSearchItem* ScGlobal::pSearchItem = NULL; ScAutoFormat* ScGlobal::pAutoFormat = NULL; + +#ifndef SC_WITHOUT_LEGACY_ADDIN FuncCollection* ScGlobal::pFuncCollection = NULL; +#endif + ScUnoAddInCollection* ScGlobal::pAddInCollection = NULL; ScUserList* ScGlobal::pUserList = NULL; String** ScGlobal::ppRscString = NULL; @@ -309,12 +317,14 @@ ScAutoFormat* ScGlobal::GetAutoFormat() return pAutoFormat; } +#ifndef SC_WITHOUT_LEGACY_ADDIN FuncCollection* ScGlobal::GetFuncCollection() { if (!pFuncCollection) pFuncCollection = new FuncCollection(); return pFuncCollection; } +#endif ScUnoAddInCollection* ScGlobal::GetAddInCollection() { @@ -564,7 +574,9 @@ void ScGlobal::Init() ScParameterClassification::Init(); srand( (unsigned) time( NULL ) ); // Random Seed Init fuer Interpreter +#ifndef SC_WITHOUT_LEGACY_ADDIN InitAddIns(); +#endif pStrClipDocName = new String( ScResId( SCSTR_NONAME ) ); *pStrClipDocName += '1'; @@ -636,11 +648,14 @@ void ScGlobal::InitTextHeight(SfxItemPool* pPool) void ScGlobal::Clear() { // asyncs _vor_ ExitExternalFunc zerstoeren! +#ifndef SC_WITHOUT_LEGACY_ADDIN theAddInAsyncTbl.DeleteAndDestroy( 0, theAddInAsyncTbl.Count() ); ExitExternalFunc(); + DELETEZ(pFuncCollection); +#endif + DELETEZ(pAutoFormat); DELETEZ(pSearchItem); - DELETEZ(pFuncCollection); DELETEZ(pAddInCollection); DELETEZ(pUserList); diff --git a/sc/source/core/data/globalx.cxx b/sc/source/core/data/globalx.cxx index cce88a1..040198f 100644 --- a/sc/source/core/data/globalx.cxx +++ b/sc/source/core/data/globalx.cxx @@ -29,9 +29,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" +#include "global.hxx" +#ifndef SC_WITHOUT_LEGACY_ADDIN #include "callform.hxx" -#include "global.hxx" +#endif + #include <tools/urlobj.hxx> #include <ucbhelper/contentbroker.hxx> #include <ucbhelper/content.hxx> @@ -55,7 +58,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; - +#ifndef SC_WITHOUT_LEGACY_ADDIN void ScGlobal::InitAddIns() { // multi paths separated by semicolons @@ -132,7 +135,7 @@ void ScGlobal::InitAddIns() } } } - +#endif // SC_WITHOUT_LEGACY_ADDIN String ScGlobal::GetOrdinalSuffix( sal_Int32 nNumber) { diff --git a/sc/source/core/inc/addinlis.hxx b/sc/source/core/inc/addinlis.hxx index 753998a..9785f60 100644 --- a/sc/source/core/inc/addinlis.hxx +++ b/sc/source/core/inc/addinlis.hxx @@ -29,13 +29,24 @@ #ifndef SC_ADDINLIS_HXX #define SC_ADDINLIS_HXX +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN #include "adiasync.hxx" // for ScAddInDocs PtrArr +#else +#include <svl/broadcast.hxx> +#include <svl/svarray.hxx> +#endif + #include <com/sun/star/sheet/XResultListener.hpp> #include <com/sun/star/sheet/XVolatileResult.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/implbase2.hxx> class ScDocument; +#ifdef SC_WITHOUT_LEGACY_ADDIN //Needs to be here if removing legacy addin +typedef ScDocument* ScAddInDocPtr; +SV_DECL_PTRARR_SORT( ScAddInDocs, ScAddInDocPtr, 1, 1 ) +#endif class ScAddInListener : public cppu::WeakImplHelper2< com::sun::star::sheet::XResultListener, diff --git a/sc/source/core/inc/adiasync.hxx b/sc/source/core/inc/adiasync.hxx index 3931d46..98cfeca 100644 --- a/sc/source/core/inc/adiasync.hxx +++ b/sc/source/core/inc/adiasync.hxx @@ -29,6 +29,9 @@ #ifndef SC_ADIASYNC_HXX #define SC_ADIASYNC_HXX +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN //Conditionally removes legacy addin + #include <svl/broadcast.hxx> #include <svl/svarray.hxx> @@ -88,7 +91,7 @@ public: BOOL operator ==( const ScAddInAsync& r ) { return nHandle == r.nHandle; } }; - +#endif // SC_WITHOUT_LEGACY_ADDIN #endif diff --git a/sc/source/core/inc/core_pch.hxx b/sc/source/core/inc/core_pch.hxx index 5a28888..3f436a6 100644 --- a/sc/source/core/inc/core_pch.hxx +++ b/sc/source/core/inc/core_pch.hxx @@ -206,7 +206,12 @@ #include <svx/svdglue.hxx> #include <editeng/langitem.hxx> #include <editeng/eeitem.hxx> + +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN #include <callform.hxx> +#endif + #include <validat.hxx> #include <editeng/brshitem.hxx> #include <sot/exchange.hxx> @@ -227,7 +232,11 @@ #include <editeng/postitem.hxx> #include <svx/svditer.hxx> #include <editeng/udlnitem.hxx> + +#ifndef SC_WITHOUT_LEGACY_ADDIN #include <adiasync.hxx> +#endif + #include <sfx2/bindings.hxx> #include <ddelink.hxx> #include <chartlis.hxx> diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index d323027..48a8207 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -219,12 +219,15 @@ inline BOOL HasCellValueData( const ScBaseCell* pCell ) inline BOOL HasCellStringData( const ScBaseCell* pCell ) { return pCell ? pCell->HasStringData() : FALSE; } +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN BOOL CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, BYTE* pCellArr); BOOL CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, BYTE* pCellArr); BOOL CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, BYTE* pCellArr); +#endif //----------------------------------------------------------------------------- // Stack operations diff --git a/sc/source/core/tool/addinlis.cxx b/sc/source/core/tool/addinlis.cxx index 69a8f52..3381d01 100644 --- a/sc/source/core/tool/addinlis.cxx +++ b/sc/source/core/tool/addinlis.cxx @@ -38,6 +38,11 @@ #include "brdcst.hxx" #include "sc.hrc" +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifdef SC_WITHOUT_LEGACY_ADDIN //Need here if removing legacy addins +SV_IMPL_PTRARR_SORT( ScAddInDocs, ScAddInDocPtr ); +#endif + using namespace com::sun::star; SC_SIMPLE_SERVICE_INFO( ScAddInListener, "ScAddInListener", "stardiv.one.sheet.AddInListener" ) diff --git a/sc/source/core/tool/adiasync.cxx b/sc/source/core/tool/adiasync.cxx index 85916d1..fc11315 100644 --- a/sc/source/core/tool/adiasync.cxx +++ b/sc/source/core/tool/adiasync.cxx @@ -29,10 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" - - -//------------------------------------------------------------------------ - #include <sfx2/objsh.hxx> #include "adiasync.hxx" @@ -42,6 +38,7 @@ #include "sc.hrc" // FID_DATACHANGED #include <osl/thread.h> +#ifndef SC_WITHOUT_LEGACY_ADDIN //Conditionally remove legacy addins //------------------------------------------------------------------------ @@ -184,6 +181,6 @@ void ScAddInAsync::RemoveDocument( ScDocument* pDocumentP ) } } - +#endif // SC_WITHOUT_LEGACY_ADDIN /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/callform.cxx b/sc/source/core/tool/callform.cxx index d83375f..106fa8a 100644 --- a/sc/source/core/tool/callform.cxx +++ b/sc/source/core/tool/callform.cxx @@ -29,19 +29,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" - - -// INCLUDE --------------------------------------------------------------- #include <vcl/svapp.hxx> #include <osl/module.hxx> #include <osl/file.hxx> #include <unotools/transliterationwrapper.hxx> -#include "callform.hxx" #include "global.hxx" -#include "adiasync.hxx" -//------------------------------------------------------------------------ +#ifndef SC_WITHOUT_LEGACY_ADDIN //Conditionally remove legacy addins + +#include "callform.hxx" +#include "adiasync.hxx" extern "C" { @@ -453,4 +451,6 @@ bool FuncData::getParamDesc( ::rtl::OUString& aName, ::rtl::OUString& aDesc, sal return bRet; } +#endif //SC_WITHOUT_LEGACY_ADDIN //Conditionally remove legacy addins + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index e98fcff..34eb794 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -58,7 +58,12 @@ #include "rangenam.hxx" #include "dbcolect.hxx" #include "document.hxx" + +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN #include "callform.hxx" +#endif + #include "addincol.hxx" #include "refupdat.hxx" #include "scresid.hxx" @@ -222,12 +227,15 @@ bool ScCompiler::IsEnglishSymbol( const String& rName ) { return true; } + +#ifndef SC_WITHOUT_LEGACY_ADDIN // 2. old add in functions USHORT nIndex; if ( ScGlobal::GetFuncCollection()->SearchFunc( aUpper, nIndex ) ) { return true; } +#endif // 3. new (uno) add in functions String aIntName(ScGlobal::GetAddInCollection()->FindFunction( aUpper, FALSE )); @@ -2497,6 +2505,7 @@ BOOL ScCompiler::IsOpCode( const String& rName, bool bInArray ) } if (!aIntName.Len()) { +#ifndef SC_WITHOUT_LEGACY_ADDIN // Old (deprecated) addins first for legacy. USHORT nIndex; bFound = ScGlobal::GetFuncCollection()->SearchFunc( cSymbol, nIndex); @@ -2507,6 +2516,7 @@ BOOL ScCompiler::IsOpCode( const String& rName, bool bInArray ) pRawToken = aToken.Clone(); } else +#endif // bLocalFirst=FALSE for (English) upper full original name // (service.function) aIntName = ScGlobal::GetAddInCollection()->FindFunction( diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 52a1a76..cc4fc8f 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -57,13 +57,21 @@ #include "global.hxx" #include "dbcolect.hxx" #include "cell.hxx" + +#ifndef SC_WITHOUT_LEGACY_ADDIN #include "callform.hxx" +#endif + #include "addincol.hxx" #include "document.hxx" #include "dociter.hxx" #include "docoptio.hxx" #include "scmatrix.hxx" + +#ifndef SC_WITHOUT_LEGACY_ADDIN #include "adiasync.hxx" +#endif + #include "sc.hrc" #include "cellsuno.hxx" #include "optuno.hxx" @@ -547,6 +555,7 @@ void ScInterpreter::GetCellString( String& rStr, const ScBaseCell* pCell ) SetError(nErr); } +#ifndef SC_WITHOUT_LEGACY_ADDIN //Conditionally remove legacy addins BOOL ScInterpreter::CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, BYTE* pCellArr) @@ -852,7 +861,7 @@ BOOL ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, *pCount = nCount; return TRUE; } - +#endif // SC_WITHOUT_LEGACY_ADDIN //----------------------------------------------------------------------------- // Stack operations @@ -2430,10 +2439,12 @@ void ScInterpreter::ScDBGet() void ScInterpreter::ScExternal() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScExternal" ); - USHORT nIndex; BYTE nParamCount = GetByte(); String aUnoName; String aFuncName( ScGlobal::pCharClass->upper( pCur->GetExternal() ) ); + +#ifndef SC_WITHOUT_LEGACY_ADDIN //Conditionally remove legacy addins + USHORT nIndex; if (ScGlobal::GetFuncCollection()->SearchFunc(aFuncName, nIndex)) { FuncData* pFuncData = (FuncData*)ScGlobal::GetFuncCollection()->At(nIndex); @@ -2625,7 +2636,9 @@ void ScInterpreter::ScExternal() PushIllegalParameter(); } } - else if ( ( aUnoName = ScGlobal::GetAddInCollection()->FindFunction(aFuncName, FALSE) ).Len() ) + else +#endif //#ifndef SC_WITHOUT_LEGACY_ADDIN + if ( ( aUnoName = ScGlobal::GetAddInCollection()->FindFunction(aFuncName, FALSE) ).Len() ) { // bLocalFirst=FALSE in FindFunction, cFunc should be the stored internal name diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx index b882da1..455c9e4 100644 --- a/sc/source/core/tool/parclass.cxx +++ b/sc/source/core/tool/parclass.cxx @@ -33,7 +33,11 @@ #include "parclass.hxx" #include "token.hxx" #include "global.hxx" + +#ifndef SC_WITHOUT_LEGACY_ADDIN #include "callform.hxx" +#endif + #include "addincol.hxx" #include "funcdesc.hxx" #include <unotools/charclass.hxx> @@ -326,9 +330,11 @@ ScParameterClassification::GetExternalParameterType( const formula::FormulaToken { Type eRet = Unknown; // similar to ScInterpreter::ScExternal() - USHORT nIndex; String aUnoName; String aFuncName( ScGlobal::pCharClass->upper( pToken->GetExternal())); + +#ifndef SC_WITHOUT_LEGACY_ADDIN + USHORT nIndex; if ( ScGlobal::GetFuncCollection()->SearchFunc( aFuncName, nIndex) ) { FuncData* pFuncData = (FuncData*)ScGlobal::GetFuncCollection()->At( @@ -349,7 +355,9 @@ ScParameterClassification::GetExternalParameterType( const formula::FormulaToken } } } - else if ( (aUnoName = ScGlobal::GetAddInCollection()->FindFunction( + else +#endif // SC_WITHOUT_LEGACY_ADDIN + if ( (aUnoName = ScGlobal::GetAddInCollection()->FindFunction( aFuncName, FALSE)).Len() ) { // the relevant parts of ScUnoAddInCall without having to create one diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 9c5ac45..17e0fde 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -43,7 +43,12 @@ #include "document.hxx" #include "compiler.hxx" #include "formula/errorcodes.hxx" + +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN #include "callform.hxx" +#endif + #include "addincol.hxx" #include "rangeseq.hxx" #include "cell.hxx" @@ -370,6 +375,7 @@ BOOL lcl_AddFunctionToken( ScTokenArray& rArray, const rtl::OUString& rName,cons return TRUE; } +#ifndef SC_WITHOUT_LEGACY_ADDIN // 2. old add in functions USHORT nIndex; @@ -378,6 +384,7 @@ BOOL lcl_AddFunctionToken( ScTokenArray& rArray, const rtl::OUString& rName,cons rArray.AddExternal( aUpper.GetBuffer() ); return TRUE; } +#endif // 3. new (uno) add in functions -- 1.7.1
From c2cb22a5072ba8ae3808b0aa8a21bc80ab57c26e Mon Sep 17 00:00:00 2001 From: Alfonso Eusebio <alfonso_euse...@yahoo.co.uk> Date: Sat, 19 Feb 2011 09:22:25 +0000 Subject: [PATCH] Conditional compilation of legacy addins in binfilter Introduces conditional compilation of legacy addin mechanism in binfilter. Controlled through a macro definition in global.hxx --- binfilter/bf_sc/source/core/data/sc_documen2.cxx | 8 ++++++-- binfilter/bf_sc/source/core/data/sc_global.cxx | 21 ++++++++++++++++++--- binfilter/bf_sc/source/core/data/sc_globalx.cxx | 5 ++++- binfilter/bf_sc/source/core/inc/addinlis.hxx | 19 ++++++++++++------- binfilter/bf_sc/source/core/inc/adiasync.hxx | 6 ++++++ binfilter/bf_sc/source/core/inc/interpre.hxx | 5 +++++ binfilter/bf_sc/source/core/tool/sc_addinlis.cxx | 5 +++++ binfilter/bf_sc/source/core/tool/sc_adiasync.cxx | 5 +++++ binfilter/bf_sc/source/core/tool/sc_callform.cxx | 4 ++++ binfilter/bf_sc/source/core/tool/sc_compiler.cxx | 8 ++++++++ binfilter/bf_sc/source/core/tool/sc_interpr4.cxx | 14 ++++++++++++-- binfilter/bf_sc/source/ui/unoobj/sc_funcuno.cxx | 7 +++++++ binfilter/inc/bf_sc/global.hxx | 10 ++++++++++ 13 files changed, 102 insertions(+), 15 deletions(-) diff --git a/binfilter/bf_sc/source/core/data/sc_documen2.cxx b/binfilter/bf_sc/source/core/data/sc_documen2.cxx index 8019db3..e2258c3 100644 --- a/binfilter/bf_sc/source/core/data/sc_documen2.cxx +++ b/binfilter/bf_sc/source/core/data/sc_documen2.cxx @@ -384,8 +384,12 @@ namespace binfilter { /*N*/ if ( pLinkManager->GetLinks().Count() ) /*N*/ pLinkManager->Remove( 0, pLinkManager->GetLinks().Count() ); /*N*/ } -/*N*/ -/*N*/ ScAddInAsync::RemoveDocument( this ); + +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN + ScAddInAsync::RemoveDocument( this ); +#endif + /*N*/ ScAddInListener::RemoveDocument( this ); /*N*/ delete pChartListenerCollection; // vor pBASM wg. evtl. Listener! /*N*/ pChartListenerCollection = NULL; diff --git a/binfilter/bf_sc/source/core/data/sc_global.cxx b/binfilter/bf_sc/source/core/data/sc_global.cxx index ab3e165..96a8f3d 100644 --- a/binfilter/bf_sc/source/core/data/sc_global.cxx +++ b/binfilter/bf_sc/source/core/data/sc_global.cxx @@ -52,7 +52,12 @@ #include "autoform.hxx" #include "patattr.hxx" #include "addincol.hxx" + +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN #include "adiasync.hxx" +#endif + #include "userlist.hxx" #include "interpre.hxx" #include "strload.hxx" @@ -72,7 +77,11 @@ namespace binfilter { ScDocShellRef* ScGlobal::pDrawClipDocShellRef = NULL; ScAutoFormat* ScGlobal::pAutoFormat = NULL; + +#ifndef SC_WITHOUT_LEGACY_ADDIN FuncCollection* ScGlobal::pFuncCollection = NULL; +#endif + ScUnoAddInCollection* ScGlobal::pAddInCollection = NULL; ScUserList* ScGlobal::pUserList = NULL; String** ScGlobal::ppRscString = NULL; @@ -307,12 +316,14 @@ void global_InitAppOptions(); /*N*/ return pAutoFormat; /*N*/ } +#ifndef SC_WITHOUT_LEGACY_ADDIN /*N*/ FuncCollection* ScGlobal::GetFuncCollection() /*N*/ { /*N*/ if (!pFuncCollection) /*N*/ pFuncCollection = new FuncCollection(); /*N*/ return pFuncCollection; /*N*/ } +#endif /*N*/ ScUnoAddInCollection* ScGlobal::GetAddInCollection() /*N*/ { @@ -431,9 +442,11 @@ void global_InitAppOptions(); /*N*/ UpdatePPT(NULL); /*N*/ ScCompiler::Init(); /*N*/ srand( (unsigned) time( NULL ) ); // Random Seed Init fuer Interpreter -/*N*/ + +#ifndef SC_WITHOUT_LEGACY_ADDIN /*N*/ InitAddIns(); -/*N*/ +#endif + /*N*/ pStrClipDocName = new String( ScResId( SCSTR_NONAME ) ); /*N*/ *pStrClipDocName += '1'; /*N*/ @@ -496,11 +509,13 @@ void global_InitAppOptions(); /*N*/ void ScGlobal::Clear() /*N*/ { +#ifndef SC_WITHOUT_LEGACY_ADDIN /*N*/ // asyncs _vor_ ExitExternalFunc zerstoeren! /*N*/ theAddInAsyncTbl.DeleteAndDestroy( 0, theAddInAsyncTbl.Count() ); /*N*/ ExitExternalFunc(); -/*N*/ DELETEZ(pAutoFormat); /*N*/ DELETEZ(pFuncCollection); +#endif +/*N*/ DELETEZ(pAutoFormat); /*N*/ DELETEZ(pAddInCollection); /*N*/ DELETEZ(pUserList); /*N*/ diff --git a/binfilter/bf_sc/source/core/data/sc_globalx.cxx b/binfilter/bf_sc/source/core/data/sc_globalx.cxx index 713673a..ed0b972 100644 --- a/binfilter/bf_sc/source/core/data/sc_globalx.cxx +++ b/binfilter/bf_sc/source/core/data/sc_globalx.cxx @@ -27,8 +27,10 @@ ************************************************************************/ -#include "callform.hxx" + #include "global.hxx" +#ifndef SC_WITHOUT_LEGACY_ADDIN +#include "callform.hxx" #include <tools/urlobj.hxx> #include <ucbhelper/contentbroker.hxx> @@ -134,5 +136,6 @@ namespace binfilter { } +#endif //SC_WITHOUT_LEGACY_ADDIN /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sc/source/core/inc/addinlis.hxx b/binfilter/bf_sc/source/core/inc/addinlis.hxx index 0ff0734..f05a769 100644 --- a/binfilter/bf_sc/source/core/inc/addinlis.hxx +++ b/binfilter/bf_sc/source/core/inc/addinlis.hxx @@ -29,21 +29,26 @@ #ifndef SC_ADDINLIS_HXX #define SC_ADDINLIS_HXX -#include "adiasync.hxx" // for ScAddInDocs PtrArr +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN +#include "adiasync.hxx" // for ScAddInDocs PtrArr +#else +#include <svl/broadcast.hxx> +#include <svl/svarray.hxx> +#endif #include <com/sun/star/sheet/XResultListener.hpp> - #include <com/sun/star/sheet/XVolatileResult.hpp> - #include <com/sun/star/lang/XServiceInfo.hpp> - #include <cppuhelper/implbase2.hxx> -namespace binfilter { - +namespace binfilter { class ScDocument; - +#ifdef SC_WITHOUT_LEGACY_ADDIN //Needs to be here if removing legacy addin +typedef ScDocument* ScAddInDocPtr; +SV_DECL_PTRARR_SORT( ScAddInDocs, ScAddInDocPtr, 1, 1 ) +#endif class ScAddInListener : public cppu::WeakImplHelper2< ::com::sun::star::sheet::XResultListener, diff --git a/binfilter/bf_sc/source/core/inc/adiasync.hxx b/binfilter/bf_sc/source/core/inc/adiasync.hxx index fd41964..da7865b 100644 --- a/binfilter/bf_sc/source/core/inc/adiasync.hxx +++ b/binfilter/bf_sc/source/core/inc/adiasync.hxx @@ -29,6 +29,9 @@ #ifndef _SC_ADIASYNC_HXX #define _SC_ADIASYNC_HXX +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN + #include <bf_svtools/brdcst.hxx> #include "callform.hxx" @@ -90,6 +93,9 @@ public: } //namespace binfilter + +#endif //SC_WITHOUT_LEGACY_ADDIN + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sc/source/core/inc/interpre.hxx b/binfilter/bf_sc/source/core/inc/interpre.hxx index 6ad17be..91aadf6 100644 --- a/binfilter/bf_sc/source/core/inc/interpre.hxx +++ b/binfilter/bf_sc/source/core/inc/interpre.hxx @@ -213,12 +213,17 @@ inline BOOL HasCellValueData( const ScBaseCell* pCell ) { return pCell ? pCell->HasValueData() : FALSE; } inline BOOL HasCellStringData( const ScBaseCell* pCell ) { return pCell ? pCell->HasStringData() : FALSE; } + +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN BOOL CreateDoubleArr(USHORT nCol1, USHORT nRow1, USHORT nTab1, USHORT nCol2, USHORT nRow2, USHORT nTab2, BYTE* pCellArr); BOOL CreateStringArr(USHORT nCol1, USHORT nRow1, USHORT nTab1, USHORT nCol2, USHORT nRow2, USHORT nTab2, BYTE* pCellArr); BOOL CreateCellArr(USHORT nCol1, USHORT nRow1, USHORT nTab1, USHORT nCol2, USHORT nRow2, USHORT nTab2, BYTE* pCellArr); +#endif + //----------------------------------------------------------------------------- // Stackoperationen //----------------------------------------------------------------------------- diff --git a/binfilter/bf_sc/source/core/tool/sc_addinlis.cxx b/binfilter/bf_sc/source/core/tool/sc_addinlis.cxx index b972743..6935c67 100644 --- a/binfilter/bf_sc/source/core/tool/sc_addinlis.cxx +++ b/binfilter/bf_sc/source/core/tool/sc_addinlis.cxx @@ -40,6 +40,11 @@ #include "bf_sc.hrc" namespace binfilter { +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifdef SC_WITHOUT_LEGACY_ADDIN +SV_IMPL_PTRARR_SORT( ScAddInDocs, ScAddInDocPtr ); // required if removing legacy addins +#endif + using namespace ::com::sun::star; //------------------------------------------------------------------------ diff --git a/binfilter/bf_sc/source/core/tool/sc_adiasync.cxx b/binfilter/bf_sc/source/core/tool/sc_adiasync.cxx index ff3223a..1e979b2 100644 --- a/binfilter/bf_sc/source/core/tool/sc_adiasync.cxx +++ b/binfilter/bf_sc/source/core/tool/sc_adiasync.cxx @@ -32,6 +32,9 @@ //------------------------------------------------------------------------ +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN + #include <bf_sfx2/objsh.hxx> #include "adiasync.hxx" @@ -145,4 +148,6 @@ static ScAddInAsync aSeekObj; } +#endif // SC_WITHOUT_LEGACY_ADDIN + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sc/source/core/tool/sc_callform.cxx b/binfilter/bf_sc/source/core/tool/sc_callform.cxx index a9f0c2a..36b897b 100644 --- a/binfilter/bf_sc/source/core/tool/sc_callform.cxx +++ b/binfilter/bf_sc/source/core/tool/sc_callform.cxx @@ -30,6 +30,8 @@ #pragma hdrstop #endif +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN #include <osl/module.hxx> @@ -272,4 +274,6 @@ public: } +#endif // SC_WITHOUT_LEGACY_ADDIN + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sc/source/core/tool/sc_compiler.cxx b/binfilter/bf_sc/source/core/tool/sc_compiler.cxx index 005fc13..4dfd916 100644 --- a/binfilter/bf_sc/source/core/tool/sc_compiler.cxx +++ b/binfilter/bf_sc/source/core/tool/sc_compiler.cxx @@ -50,6 +50,11 @@ #include "rangenam.hxx" #include "dbcolect.hxx" #include "document.hxx" + +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN +#endif + #include "callform.hxx" #include "addincol.hxx" #include "refupdat.hxx" @@ -763,6 +768,7 @@ namespace binfilter { /*N*/ } /*N*/ else /*N*/ { +#ifndef SC_WITHOUT_LEGACY_ADDIN /*N*/ USHORT nIndex; /*N*/ bFound = ScGlobal::GetFuncCollection()->SearchFunc(cSymbol, nIndex); /*N*/ if( bFound ) @@ -772,6 +778,8 @@ namespace binfilter { /*N*/ /*?*/ pRawToken = aToken.Clone(); /*N*/ } /*N*/ else +#endif + /*N*/ { /*N*/ // bLocalFirst=FALSE for english /*N*/ String aIntName = ScGlobal::GetAddInCollection()-> diff --git a/binfilter/bf_sc/source/core/tool/sc_interpr4.cxx b/binfilter/bf_sc/source/core/tool/sc_interpr4.cxx index 7e4a91b..bd8b002 100644 --- a/binfilter/bf_sc/source/core/tool/sc_interpr4.cxx +++ b/binfilter/bf_sc/source/core/tool/sc_interpr4.cxx @@ -325,6 +325,8 @@ USHORT ScInterpreter::GetCellErrCode( const ScBaseCell* pCell ) return 0; } +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN BOOL ScInterpreter::CreateDoubleArr(USHORT nCol1, USHORT nRow1, USHORT nTab1, USHORT nCol2, USHORT nRow2, USHORT nTab2, BYTE* pCellArr) @@ -604,6 +606,9 @@ BOOL ScInterpreter::CreateCellArr(USHORT nCol1, USHORT nRow1, USHORT nTab1, return TRUE; } +#endif // SC_WITHOUT_LEGACY_ADDIN + + //----------------------------------------------------------------------------- // Stackoperationen //----------------------------------------------------------------------------- @@ -1426,10 +1431,12 @@ BOOL ScInterpreter::DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& r /*N*/ void ScInterpreter::ScExternal() /*N*/ { -/*N*/ USHORT nIndex; /*N*/ BYTE nParamCount = GetByte(); /*N*/ String aUnoName; /*N*/ String aFuncName( ScGlobal::pCharClass->upper( pCur->GetExternal() ) ); + +#ifndef SC_WITHOUT_LEGACY_ADDIN +/*N*/ USHORT nIndex; /*N*/ if (ScGlobal::GetFuncCollection()->SearchFunc(aFuncName, nIndex)) /*N*/ { /*?*/ FuncData* pFuncData = (FuncData*)ScGlobal::GetFuncCollection()->At(nIndex); @@ -1611,7 +1618,10 @@ BOOL ScInterpreter::DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& r /*?*/ PushInt(0); /*?*/ } /*N*/ } -/*N*/ else if ( ( aUnoName = ScGlobal::GetAddInCollection()->FindFunction(aFuncName, FALSE) ).Len() ) +/*N*/ else +#endif // SC_WITHOUT_LEGACY_ADDIN + + if ( ( aUnoName = ScGlobal::GetAddInCollection()->FindFunction(aFuncName, FALSE) ).Len() ) /*N*/ { /*N*/ // bLocalFirst=FALSE in FindFunction, cFunc should be the stored internal name /*N*/ diff --git a/binfilter/bf_sc/source/ui/unoobj/sc_funcuno.cxx b/binfilter/bf_sc/source/ui/unoobj/sc_funcuno.cxx index 1ea510d..3fe1de9 100644 --- a/binfilter/bf_sc/source/ui/unoobj/sc_funcuno.cxx +++ b/binfilter/bf_sc/source/ui/unoobj/sc_funcuno.cxx @@ -38,7 +38,12 @@ #include <vcl/svapp.hxx> #include "scdll.hxx" #include "document.hxx" + +#include "global.hxx" // for SC_WITHOUT_LEGACY_ADDIN definition +#ifndef SC_WITHOUT_LEGACY_ADDIN #include "callform.hxx" +#endif + #include "addincol.hxx" #include "rangeseq.hxx" #include "cell.hxx" @@ -325,6 +330,7 @@ BOOL lcl_AddFunctionToken( ScTokenArray& rArray, const ::rtl::OUString& rName ) return TRUE; } +#ifndef SC_WITHOUT_LEGACY_ADDIN // 2. old add in functions USHORT nIndex; @@ -333,6 +339,7 @@ BOOL lcl_AddFunctionToken( ScTokenArray& rArray, const ::rtl::OUString& rName ) rArray.AddExternal( aUpper.GetBuffer() ); return TRUE; } +#endif // 3. new (uno) add in functions diff --git a/binfilter/inc/bf_sc/global.hxx b/binfilter/inc/bf_sc/global.hxx index 1d7201b..3c57573 100644 --- a/binfilter/inc/bf_sc/global.hxx +++ b/binfilter/inc/bf_sc/global.hxx @@ -29,6 +29,9 @@ #ifndef SC_SCGLOB_HXX #define SC_SCGLOB_HXX +// Remove comment below to remove legacy addins mechanism +//#define SC_WITHOUT_LEGACY_ADDIN // When defined the legacy addin mechanism is not compiled in + #include <i18npool/lang.h> #include <tools/stream.hxx> #include <osl/endian.h> @@ -509,7 +512,10 @@ class ScUnitConverter; class ScGlobal { static ScAutoFormat* pAutoFormat; + +#ifndef SC_WITHOUT_LEGACY_ADDIN static FuncCollection* pFuncCollection; +#endif static ScUnoAddInCollection* pAddInCollection; static ScUserList* pUserList; static String** ppRscString; @@ -550,7 +556,9 @@ public: static LanguageType eLnge; static sal_Unicode cListDelimiter; static ScAutoFormat* GetAutoFormat(); +#ifndef SC_WITHOUT_LEGACY_ADDIN static FuncCollection* GetFuncCollection(); +#endif static ScUnoAddInCollection* GetAddInCollection(); static ScUserList* GetUserList(); static void SetUserList( const ScUserList* pNewList ); @@ -576,7 +584,9 @@ public: static long nLastColWidthExtra; static void Init(); // am Anfang +#ifndef SC_WITHOUT_LEGACY_ADDIN static void InitAddIns(); +#endif static void Clear(); // bei Programmende static void UpdatePPT(OutputDevice* pDev); -- 1.7.1
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice