[Libreoffice] [PATCH] Conditional compilation of legacy Addin mechanism in calc

Kohei Yoshida kyoshida at novell.com
Mon Feb 21 13:00:20 PST 2011


On Sat, 2011-02-19 at 09:33 +0000, Alfonso Eusebio wrote:
> 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.

Thanks a lot for this patch.  This helps identify those code blocks that
can potentially be removed later.

One correction is needed however.  You've used #ifndef .... #endif block
throughout the code base to conditionally disable code blocks, but the
better way is to define in global.hxx

#define SC_WITH_LEGACY_ADDIN 1

and use

#if SC_WITH_LEGACY_ADDIN

  code block

#endif

This way, all you have to do to enable/disable the code is to toggle the
value of SC_WITH_LEGACY_ADDIN in the global.hxx and re-compile.

Another thing is to associate the value of 1 to enabling, and the value
of 0 to disabling, to make it easier for the brain to process this, as
it requires a bit of extra work mentally to process 0 for enabling and 1
for disabling.

Thanks!

Kohei



More information about the LibreOffice mailing list