[Libreoffice-commits] core.git: sc/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Fri Jul 15 13:15:34 UTC 2016


 sc/source/filter/oox/formulabase.cxx |   19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

New commits:
commit 7da80de2c75e048a08ea6e923a9f433a638a9f12
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Thu Jul 14 17:07:45 2016 +0200

    sc: remove FUNC* and OOX_XLS_IS_LIBNAME macros
    
    FUNCLIB_TO_FUNCFLAGS is odd because the only FunctionLibraryType
    is FUNCLIB_EUROTOOL = 1, left shifted 12 times gives 0x1000
    same as FUNCFLAG_BIFFEXPORTONLY.
    
    remove the FUNC macros.
    create a new FUNCFLAG_EUROTOOL value for the euro tool lib
    and map it to FUNCLIB_EUROTOOL.
    
    inline OOX_XLS_IS_LIBNAME macro.
    
    Change-Id: Ia5d1f634ae4dfa5fd8cc5109e47113b2a5b95d7d
    Reviewed-on: https://gerrit.libreoffice.org/27221
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index 232d569..80c277c 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -220,11 +220,7 @@ const sal_uInt16 FUNCFLAG_MACROCALL_NEW     = FUNCFLAG_MACROCALL | FUNCFLAG_MACR
 const sal_uInt16 FUNCFLAG_BIFFIMPORTONLY    = 0x0800;   /// Only used in BIFF binary import filter.
 const sal_uInt16 FUNCFLAG_BIFFEXPORTONLY    = 0x1000;   /// Only used in BIFF binary export filter.
 const sal_uInt16 FUNCFLAG_INTERNAL          = 0x2000;   /// Function is internal in Calc.
-
-/// Converts a function library index (value of enum FunctionLibraryType) to function flags.
-#define FUNCLIB_TO_FUNCFLAGS( funclib_index ) static_cast< sal_uInt16 >( static_cast< sal_uInt8 >( funclib_index ) << 12 )
-/// Extracts a function library index (value of enum FunctionLibraryType) from function flags.
-#define FUNCFLAGS_TO_FUNCLIB( func_flags ) extractValue< FunctionLibraryType >( func_flags, 12, 4 )
+const sal_uInt16 FUNCFLAG_EUROTOOL          = 0x4000;   /// function of euro tool lib, FUNCLIB_EUROTOOL
 
 typedef std::shared_ptr< FunctionInfo > FunctionInfoRef;
 
@@ -679,8 +675,7 @@ static const FunctionData saFuncTableBiff5[] =
     { "ROMAN",                  "ROMAN",                354,    354,    1,  2,  V, { VR }, 0 },
 
     // *** EuroTool add-in ***
-
-    { "EUROCONVERT",            "EUROCONVERT",          NOID,   NOID,   3,  5,  V, { VR }, FUNCLIB_TO_FUNCFLAGS( FUNCLIB_EUROTOOL ) },
+    { "EUROCONVERT",            "EUROCONVERT",          NOID,   NOID,   3,  5,  V, { VR }, FUNCFLAG_EUROTOOL },
 
     // *** macro sheet commands ***
 
@@ -1117,8 +1112,7 @@ void FunctionProviderImpl::initFunc( const FunctionData& rFuncData, sal_uInt8 nM
         OSL_ENSURE( !xFuncInfo->maOdfFuncName.isEmpty(), "FunctionProviderImpl::initFunc - missing ODF function name" );
         xFuncInfo->maBiffMacroName = "_xlfnodf." + xFuncInfo->maOdfFuncName;
     }
-
-    xFuncInfo->meFuncLibType = FUNCFLAGS_TO_FUNCLIB( rFuncData.mnFlags );
+    xFuncInfo->meFuncLibType = (rFuncData.mnFlags & FUNCFLAG_EUROTOOL) ? FUNCLIB_EUROTOOL : FUNCLIB_UNKNOWN;
     xFuncInfo->mnApiOpCode = -1;
     xFuncInfo->mnBiff12FuncId = rFuncData.mnBiff12FuncId;
     xFuncInfo->mnBiffFuncId = rFuncData.mnBiffFuncId;
@@ -1189,14 +1183,11 @@ const FunctionInfo* FunctionProvider::getFuncInfoFromMacroName( const OUString&
 
 FunctionLibraryType FunctionProvider::getFuncLibTypeFromLibraryName( const OUString& rLibraryName )
 {
-#define OOX_XLS_IS_LIBNAME( libname, basename ) (libname.equalsIgnoreAsciiCase( basename ".XLA" ) || libname.equalsIgnoreAsciiCase( basename ".XLAM" ))
-
     // the EUROTOOL add-in containing the EUROCONVERT function
-    if( OOX_XLS_IS_LIBNAME( rLibraryName, "EUROTOOL" ) )
+    if(   rLibraryName.equalsIgnoreAsciiCase("EUROTOOL.XLA")
+       || rLibraryName.equalsIgnoreAsciiCase("EUROTOOL.XLAM"))
         return FUNCLIB_EUROTOOL;
 
-#undef OOX_XLS_IS_LIBNAME
-
     // default: unknown library
     return FUNCLIB_UNKNOWN;
 }


More information about the Libreoffice-commits mailing list