summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--formula/source/core/resource/core_resource.src7
-rw-r--r--include/formula/compiler.hrc3
-rw-r--r--include/formula/opcode.hxx1
-rw-r--r--sc/inc/helpids.h1
-rw-r--r--sc/qa/unit/ucalc.cxx1
-rw-r--r--sc/source/core/inc/interpre.hxx1
-rw-r--r--sc/source/core/tool/interpr4.cxx1
-rw-r--r--sc/source/core/tool/interpr6.cxx23
-rw-r--r--sc/source/filter/excel/xlformula.cxx3
-rw-r--r--sc/source/filter/oox/formulabase.cxx3
-rw-r--r--sc/source/ui/src/scfuncs.src31
11 files changed, 72 insertions, 3 deletions
diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src
index 90cd6e5266c3..7b69e055f42a 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -435,6 +435,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
String SC_OPCODE_ERF_MS { Text = "COM.MICROSOFT.ERF.PRECISE" ; };
String SC_OPCODE_ERFC_MS { Text = "COM.MICROSOFT.ERFC.PRECISE" ; };
String SC_OPCODE_ENCODEURL { Text = "COM.MICROSOFT.ENCODEURL"; };
+ String SC_OPCODE_RAWSUBTRACT { Text = "ORG.LIBREOFFICE.RAWSUBTRACT"; };
};
/** These function names are used only in the XLSX import. */
@@ -857,6 +858,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
String SC_OPCODE_ERF_MS { Text = "_xlfn.ERF.PRECISE" ; };
String SC_OPCODE_ERFC_MS { Text = "_xlfn.ERFC.PRECISE" ; };
String SC_OPCODE_ENCODEURL { Text = "_xlfn.ENCODEURL"; };
+ String SC_OPCODE_RAWSUBTRACT { Text = "_xlfn.ORG.LIBREOFFICE.RAWSUBTRACT"; };
};
// DO NOT CHANGE NAMES! Only add functions.
@@ -1281,6 +1283,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
String SC_OPCODE_ERF_MS { Text = "ERF.PRECISE" ; };
String SC_OPCODE_ERFC_MS { Text = "ERFC.PRECISE" ; };
String SC_OPCODE_ENCODEURL { Text = "ENCODEURL"; };
+ String SC_OPCODE_RAWSUBTRACT { Text = "RAWSUBTRACT"; };
};
Resource RID_STRLIST_FUNCTION_NAMES
@@ -2879,6 +2882,10 @@ Resource RID_STRLIST_FUNCTION_NAMES
{
Text [ en-US ] = "ENCODEURL";
};
+ String SC_OPCODE_RAWSUBTRACT
+ {
+ Text [ en-US ] = "RAWSUBTRACT";
+ };
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc
index 984ec02c0edd..5e8f7b568ce9 100644
--- a/include/formula/compiler.hrc
+++ b/include/formula/compiler.hrc
@@ -485,7 +485,8 @@
#define SC_OPCODE_NETWORKDAYS 474
#define SC_OPCODE_FLOOR_MATH 475
#define SC_OPCODE_FLOOR_PRECISE 476
-#define SC_OPCODE_STOP_2_PAR 477 /* last function with two or more parameters' OpCode + 1 */
+#define SC_OPCODE_RAWSUBTRACT 477
+#define SC_OPCODE_STOP_2_PAR 478 /* last function with two or more parameters' OpCode + 1 */
#define SC_OPCODE_STOP_FUNCTION SC_OPCODE_STOP_2_PAR /* last function's OpCode + 1 */
#define SC_OPCODE_LAST_OPCODE_ID (SC_OPCODE_STOP_FUNCTION - 1) /* last OpCode */
diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx
index 0c4c8e8f510e..a767dfcc3a06 100644
--- a/include/formula/opcode.hxx
+++ b/include/formula/opcode.hxx
@@ -281,6 +281,7 @@ enum OpCode : sal_uInt16
ocEffective = SC_OPCODE_EFFECTIVE,
ocNominal = SC_OPCODE_NOMINAL,
ocSubTotal = SC_OPCODE_SUB_TOTAL,
+ ocRawSubtract = SC_OPCODE_RAWSUBTRACT,
// Database functions
ocDBSum = SC_OPCODE_DB_SUM,
ocDBCount = SC_OPCODE_DB_COUNT,
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 3b41eb8b2495..6f2ab4ebd17f 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -632,5 +632,6 @@
#define HID_FUNC_CEIL_MATH "SC_HID_FUNC_CEIL_MATH"
#define HID_FUNC_FLOOR_MATH "SC_HID_FUNC_FLOOR_MATH"
#define HID_FUNC_FLOOR_PRECISE "SC_HID_FUNC_FLOOR_PRECISE"
+#define HID_FUNC_RAWSUBTRACT "SC_HID_FUNC_RAWSUBTRACT"
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index bf22802d95db..8de363a75dd7 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2529,6 +2529,7 @@ void Test::testFunctionLists()
"PRODUCT",
"RADIANS",
"RAND",
+ "RAWSUBTRACT",
"ROUND",
"ROUNDDOWN",
"ROUNDUP",
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 9bdb46135506..eefd16af7b33 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -515,6 +515,7 @@ void ScVar( bool bTextAsZero = false );
void ScVarP( bool bTextAsZero = false );
void ScStDev( bool bTextAsZero = false );
void ScStDevP( bool bTextAsZero = false );
+void ScRawSubtract();
void ScColumns();
void ScRows();
void ScSheets();
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index d6b969425e8a..36047f8dc875 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3769,6 +3769,7 @@ StackVar ScInterpreter::Interpret()
case ocSumX2MY2 : ScSumX2MY2(); break;
case ocSumX2DY2 : ScSumX2DY2(); break;
case ocSumXMY2 : ScSumXMY2(); break;
+ case ocRawSubtract : ScRawSubtract(); break;
case ocLog : ScLog(); break;
case ocGCD : ScGCD(); break;
case ocLCM : ScLCM(); break;
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 5bf453300c81..27d88c8c638f 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -898,4 +898,27 @@ void ScInterpreter::ScCount2()
PushDouble( IterateParameters( ifCOUNT2 ) );
}
+void ScInterpreter::ScRawSubtract()
+{
+ short nParamCount = GetByte();
+ if (!MustHaveParamCountMin( nParamCount, 2))
+ return;
+
+ // Fish the 1st parameter from the stack and push it on top.
+ FormulaToken* p = pStack[ sp - nParamCount ];
+ PushWithoutError( *p );
+ // Obtain the minuend.
+ double fRes = GetDouble();
+
+ while (!nGlobalError && nParamCount-- > 1)
+ {
+ // Simple single values without matrix support.
+ fRes -= GetDouble();
+ }
+ while (nParamCount-- > 0)
+ PopError();
+
+ PushDouble( fRes);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index 5d060cf739ba..550d9e75db13 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -587,7 +587,8 @@ static const XclFunctionInfo saFuncTable_Odf[] =
static const XclFunctionInfo saFuncTable_OOoLO[] =
{
EXC_FUNCENTRY_OOO( ocConvert, 3, 3, 0, "ORG.OPENOFFICE.CONVERT" ),
- EXC_FUNCENTRY_OOO( ocColor, 3, 4, 0, "ORG.LIBREOFFICE.COLOR" )
+ EXC_FUNCENTRY_OOO( ocColor, 3, 4, 0, "ORG.LIBREOFFICE.COLOR" ),
+ EXC_FUNCENTRY_OOO( ocRawSubtract, 2, MX, 0, "ORG.LIBREOFFICE.RAWSUBTRACT" )
};
#undef EXC_FUNCENTRY_OOO
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index b17a896f4ba9..bf894e1383b4 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -925,7 +925,8 @@ static const FunctionData saFuncTableOOoLO[] =
{ "ORG.OPENOFFICE.ROT13", "COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETROT13", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_IMPORTONLY | FUNCFLAG_EXTERNAL },
// Other functions.
{ "ORG.OPENOFFICE.CONVERT", "ORG.OPENOFFICE.CONVERT", NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALL_NEW },
- { "ORG.LIBREOFFICE.COLOR", "ORG.LIBREOFFICE.COLOR", NOID, NOID, 3, 4, V, { VR }, FUNCFLAG_MACROCALL_NEW }
+ { "ORG.LIBREOFFICE.COLOR", "ORG.LIBREOFFICE.COLOR", NOID, NOID, 3, 4, V, { VR }, FUNCFLAG_MACROCALL_NEW },
+ { "ORG.LIBREOFFICE.RAWSUBTRACT","ORG.LIBREOFFICE.RAWSUBTRACT",NOID, NOID, 1, MX, V, { RX }, FUNCFLAG_MACROCALL_NEW }
};
const sal_Unicode API_TOKEN_OPEN = '(';
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index 44287c4dd1c1..7a8d30f521b2 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -12376,6 +12376,37 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
Text [ en-US ] = "The lower limit for integration";
};
};
+ Resource SC_OPCODE_RAWSUBTRACT
+ {
+ String 1 // Description
+ {
+ Text [ en-US ] = "Returns the subtraction of numbers. Like a-b-c but without eliminating small roundoff errors." ;
+ };
+ ExtraData =
+ {
+ 0;
+ ID_FUNCTION_GRP_MATH;
+ U2S( HID_FUNC_RAWSUBTRACT );
+ VAR_ARGS+2; 0; 0; 1;
+ 0;
+ };
+ String 2 // Name of Parameter 1
+ {
+ Text [ en-US ] = "number" ;
+ };
+ String 3 // Description of Parameter 1
+ {
+ Text [ en-US ] = "Number from which following arguments are subtracted." ;
+ };
+ String 4 // Name of Parameter 2
+ {
+ Text [ en-US ] = "number " ;
+ };
+ String 5 // Description of Parameter 2
+ {
+ Text [ en-US ] = "Number 2, number 3, ... are arguments subtracted from first number." ;
+ };
+ };
};
#if defined(U2S)