This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch openformula in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit d5beb788e80780f5e6a205e3527655b38a892b71 Author: Pedro Giffuni <[email protected]> AuthorDate: Wed Nov 18 01:02:28 2026 -0500 RRI: Rename ocZGZ to ocRRI, add ZGZ as compatibility alias - Rename internal opcode identifier: ocZGZ -> ocRRI (opcode value 256 preserved) - Make RRI the canonical function name in English/ODFF name tables - Add ZGZ as read-only compatibility alias mapping to ocRRI - Update all references: opcode.hxx, compiler.hrc, core_resource.src - Update interpreter: ScZGZ -> ScRRI, dispatch table - Update Function Wizard: SC_OPCODE_RRI, HID_FUNC_RRI - Update help: HID_FUNC_RRI, 04060118.xhp - Update ODF import: ocRRI for RRI - Update Quattro Pro import: ocRRI - Update formula compiler: ZGZ alias for ocRRI in English/PODF/ODFF/Native - Update BIFF/Quattro Pro filters: ocRRI - Update help: HID_FUNC_RRI, 04060118.xhp uses HID_FUNC_RRI Preserves numeric opcode (256), BIFF compatibility, and ODF import/export. Existing documents with ZGZ remain readable through alias. --- main/formula/inc/formula/compiler.hrc | 2 +- main/formula/inc/formula/opcode.hxx | 2 +- main/formula/source/core/api/FormulaCompiler.cxx | 13 ++++++++++++- main/formula/source/core/resource/core_resource.src | 6 +++--- main/helpcontent2/source/text/scalc/01/04060118.xhp | 14 +++++++------- main/sc/inc/helpids.h | 1 + main/sc/source/core/inc/interpre.hxx | 2 +- main/sc/source/core/tool/interpr2.cxx | 4 ++-- main/sc/source/core/tool/interpr4.cxx | 2 +- main/sc/source/core/tool/parclass.cxx | 4 ++-- main/sc/source/filter/excel/xlformula.cxx | 2 +- main/sc/source/filter/qpro/qproform.cxx | 4 ++-- main/sc/source/ui/src/scfuncs.src | 8 ++++---- main/sc/util/hidother.src | 1 + 14 files changed, 39 insertions(+), 26 deletions(-) diff --git a/main/formula/inc/formula/compiler.hrc b/main/formula/inc/formula/compiler.hrc index 63c7536d12..0ce585b885 100644 --- a/main/formula/inc/formula/compiler.hrc +++ b/main/formula/inc/formula/compiler.hrc @@ -249,7 +249,7 @@ #define SC_OPCODE_ROWS 253 #define SC_OPCODE_COLUMN 254 #define SC_OPCODE_ROW 255 -#define SC_OPCODE_ZGZ 256 +#define SC_OPCODE_RRI 256 #define SC_OPCODE_ZW 257 #define SC_OPCODE_ZZR 258 #define SC_OPCODE_ZINS 259 diff --git a/main/formula/inc/formula/opcode.hxx b/main/formula/inc/formula/opcode.hxx index d9f0135636..802ef02b5e 100644 --- a/main/formula/inc/formula/opcode.hxx +++ b/main/formula/inc/formula/opcode.hxx @@ -241,7 +241,7 @@ enum OpCodeEnum ocRows = SC_OPCODE_ROWS, ocColumn = SC_OPCODE_COLUMN, ocRow = SC_OPCODE_ROW, - ocZGZ = SC_OPCODE_ZGZ, + ocRRI = SC_OPCODE_RRI, ocZW = SC_OPCODE_ZW, ocZZR = SC_OPCODE_ZZR, ocZins = SC_OPCODE_ZINS, diff --git a/main/formula/source/core/api/FormulaCompiler.cxx b/main/formula/source/core/api/FormulaCompiler.cxx index 7c56e6d6f2..1b315967bf 100644 --- a/main/formula/source/core/api/FormulaCompiler.cxx +++ b/main/formula/source/core/api/FormulaCompiler.cxx @@ -112,7 +112,7 @@ short lcl_GetRetFormat( OpCode eOpCode ) case ocZins: case ocIRR: case ocMIRR: - case ocZGZ: + case ocRRI: case ocEffektiv: case ocNominal: case ocPercentSign: @@ -620,6 +620,8 @@ void lcl_fillNativeSymbols(FormulaCompiler::NonConstOpCodeMapPtr& _xMap,bool _de OModuleClient aModuleClient; OpCodeList aOpCodeListNative( RID_STRLIST_FUNCTION_NAMES, s_SymbolMap ); // No AddInMap for native core mapping. + // Add ZGZ as alias for RRI (ocRRI) for backward compatibility + s_SymbolMap->putOpCode(String::CreateFromAscii("ZGZ"), ocRRI); } // if ( !s_SymbolMap.get() ) _xMap = s_SymbolMap; } @@ -658,6 +660,9 @@ void FormulaCompiler::InitSymbolsEnglish() const static NonConstOpCodeMapPtr s_sSymbol; if ( !s_sSymbol.get() ) loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH,FormulaGrammar::GRAM_ENGLISH,s_sSymbol); + // Add ZGZ as alias for RRI (ocRRI) for backward compatibility + if (s_sSymbol.get()) + s_sSymbol->putOpCode(String::CreateFromAscii("ZGZ"), ocRRI); mxSymbolsEnglish = s_sSymbol; } // ----------------------------------------------------------------------------- @@ -666,6 +671,9 @@ void FormulaCompiler::InitSymbolsPODF() const static NonConstOpCodeMapPtr s_sSymbol; if ( !s_sSymbol.get() ) loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH,FormulaGrammar::GRAM_PODF,s_sSymbol); + // Add ZGZ as alias for RRI (ocRRI) for backward compatibility + if (s_sSymbol.get()) + s_sSymbol->putOpCode(String::CreateFromAscii("ZGZ"), ocRRI); mxSymbolsPODF = s_sSymbol; } // ----------------------------------------------------------------------------- @@ -674,6 +682,9 @@ void FormulaCompiler::InitSymbolsODFF() const static NonConstOpCodeMapPtr s_sSymbol; if ( !s_sSymbol.get() ) loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF,FormulaGrammar::GRAM_ODFF,s_sSymbol); + // Add ZGZ as alias for RRI (ocRRI) for backward compatibility + if (s_sSymbol.get()) + s_sSymbol->putOpCode(String::CreateFromAscii("ZGZ"), ocRRI); mxSymbolsODFF = s_sSymbol; } // ----------------------------------------------------------------------------- diff --git a/main/formula/source/core/resource/core_resource.src b/main/formula/source/core/resource/core_resource.src index b205609c02..6a2c10dcfc 100644 --- a/main/formula/source/core/resource/core_resource.src +++ b/main/formula/source/core/resource/core_resource.src @@ -212,7 +212,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF String SC_OPCODE_COLUMN { Text = "COLUMN" ; }; String SC_OPCODE_ROW { Text = "ROW" ; }; String SC_OPCODE_TABLE { Text = "SHEET" ; }; - String SC_OPCODE_ZGZ { Text = "ZGZ" ; }; + String SC_OPCODE_RRI { Text = "RRI" ; }; String SC_OPCODE_ZW { Text = "FV" ; }; String SC_OPCODE_ZZR { Text = "NPER" ; }; String SC_OPCODE_ZINS { Text = "RATE" ; }; @@ -564,7 +564,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH String SC_OPCODE_COLUMN { Text = "COLUMN" ; }; String SC_OPCODE_ROW { Text = "ROW" ; }; String SC_OPCODE_TABLE { Text = "SHEET" ; }; - String SC_OPCODE_ZGZ { Text = "ZGZ" ; }; + String SC_OPCODE_RRI { Text = "RRI" ; }; String SC_OPCODE_ZW { Text = "FV" ; }; String SC_OPCODE_ZZR { Text = "NPER" ; }; String SC_OPCODE_ZINS { Text = "RATE" ; }; @@ -1393,7 +1393,7 @@ Resource RID_STRLIST_FUNCTION_NAMES { Text [ en-US ] = "SHEET" ; }; - String SC_OPCODE_ZGZ + String SC_OPCODE_RRI { Text [ en-US ] = "RRI" ; }; diff --git a/main/helpcontent2/source/text/scalc/01/04060118.xhp b/main/helpcontent2/source/text/scalc/01/04060118.xhp index 6ff299f386..e611943a0d 100644 --- a/main/helpcontent2/source/text/scalc/01/04060118.xhp +++ b/main/helpcontent2/source/text/scalc/01/04060118.xhp @@ -258,18 +258,18 @@ <bookmark_value>calculating;rates of return</bookmark_value> <bookmark_value>RRI function</bookmark_value> </bookmark> -<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_ZGZ" id="bm_id3146996" localize="false"/> +<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_RRI" id="bm_id3146996" localize="false"/> <paragraph role="heading" id="hd_id3148822" xml-lang="en-US" level="2">RRI</paragraph> -<paragraph role="paragraph" id="par_id3154293" xml-lang="en-US" l10n="U"><ahelp hid="HID_FUNC_ZGZ">Calculates the interest rate resulting from the profit (return) of an investment.</ahelp></paragraph> +<paragraph role="paragraph" id="par_id3154293" xml-lang="en-US" l10n="U"><ahelp hid="HID_FUNC_RRI">Calculates the equivalent interest rate for the growth of an investment.</ahelp></paragraph> <paragraph role="heading" id="hd_id3148444" xml-lang="en-US" level="3" l10n="U">Syntax</paragraph> <paragraph role="code" id="par_id3148804" xml-lang="en-US" l10n="U">RRI(P; PV; FV)</paragraph> -<paragraph role="paragraph" id="par_id3154901" xml-lang="en-US" l10n="U"><emph>P</emph> is the number of periods needed for calculating the interest rate.</paragraph> -<paragraph role="paragraph" id="par_id3159149" xml-lang="en-US" l10n="U"><emph>PV</emph> is the present (current) value. The cash value is the deposit of cash or the current cash value of an allowance in kind. As a deposit value a positive value must be entered; the deposit must not be 0 or <0.</paragraph> -<paragraph role="paragraph" id="par_id3149771" xml-lang="en-US" l10n="U"><emph>FV</emph> determines what is desired as the cash value of the deposit.</paragraph> +<paragraph role="paragraph" id="par_id3154901" xml-lang="en-US" l10n="U"><emph>P</emph> is the number of periods.</paragraph> +<paragraph role="paragraph" id="par_id3159149" xml-lang="en-US" l10n="U"><emph>PV</emph> is the present value of the investment. Must be greater than 0.</paragraph> +<paragraph role="paragraph" id="par_id3149771" xml-lang="en-US" l10n="U"><emph>FV</emph> is the future value of the investment.</paragraph> <paragraph role="heading" id="hd_id3148941" xml-lang="en-US" level="3" l10n="U">Example</paragraph> -<paragraph role="paragraph" id="par_id3154212" xml-lang="en-US" l10n="U">For four periods (years) and a cash value of 7,500 currency units, the interest rate of the return is to be calculated if the future value is 10,000 currency units.</paragraph> +<paragraph role="paragraph" id="par_id3154212" xml-lang="en-US" l10n="U">For four periods and a present value of 7,500 currency units, the interest rate is calculated for a future value of 10,000 currency units.</paragraph> <paragraph role="paragraph" id="par_id3150775" xml-lang="en-US" l10n="U"><item type="input">=RRI(4;7500;10000)</item> = 7.46%</paragraph> -<paragraph role="paragraph" id="par_id3145413" xml-lang="en-US" l10n="U">The interest rate must be 7.46% so that 7,500 currency units will become 10,000 currency units.</paragraph> +<paragraph role="paragraph" id="par_id3145413" xml-lang="en-US" l10n="U">The interest rate must be 7.46% for 7,500 currency units to grow to 10,000 currency units in four periods.</paragraph> </section> <section id="rate"> <bookmark xml-lang="en-US" branch="index" id="bm_id3154267"> diff --git a/main/sc/inc/helpids.h b/main/sc/inc/helpids.h index 8edadd225a..a8f217188a 100644 --- a/main/sc/inc/helpids.h +++ b/main/sc/inc/helpids.h @@ -526,6 +526,7 @@ #define HID_FUNC_IKV "SC_HID_FUNC_IKV" #define HID_FUNC_LAUFZEIT "SC_HID_FUNC_LAUFZEIT" #define HID_FUNC_ZGZ "SC_HID_FUNC_ZGZ" +#define HID_FUNC_RRI "SC_HID_FUNC_RRI" #define HID_FUNC_QIKV "SC_HID_FUNC_QIKV" #define HID_FUNC_ISPMT "SC_HID_FUNC_ISPMT" diff --git a/main/sc/source/core/inc/interpre.hxx b/main/sc/source/core/inc/interpre.hxx index 8fdb5b6ba6..7659aad31c 100644 --- a/main/sc/source/core/inc/interpre.hxx +++ b/main/sc/source/core/inc/interpre.hxx @@ -669,7 +669,7 @@ void ScLIA(); double ScGetRmz(double fZins, double fZzr, double fBw, double fZw, double fF); void ScRMZ(); -void ScZGZ(); +void ScRRI(); double ScGetZw(double fZins, double fZzr, double fRmz, double fBw, double fF); void ScZW(); diff --git a/main/sc/source/core/tool/interpr2.cxx b/main/sc/source/core/tool/interpr2.cxx index 2b8afad255..3f0e62f9f9 100644 --- a/main/sc/source/core/tool/interpr2.cxx +++ b/main/sc/source/core/tool/interpr2.cxx @@ -1357,9 +1357,9 @@ void ScInterpreter::ScRMZ() PushDouble(ScGetRmz(nZins, nZzr, nBw, nZw, nFlag)); } -void ScInterpreter::ScZGZ() +void ScInterpreter::ScRRI() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZGZ" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRRI" ); nFuncFmtType = NUMBERFORMAT_PERCENT; if ( MustHaveParamCount( GetByte(), 3 ) ) { diff --git a/main/sc/source/core/tool/interpr4.cxx b/main/sc/source/core/tool/interpr4.cxx index c4f3be9cf2..8d9c1074a7 100644 --- a/main/sc/source/core/tool/interpr4.cxx +++ b/main/sc/source/core/tool/interpr4.cxx @@ -3616,7 +3616,7 @@ StackVar ScInterpreter::Interpret() case ocColumn : ScColumn(); break; case ocRow : ScRow(); break; case ocTable : ScTable(); break; - case ocZGZ : ScZGZ(); break; + case ocRRI : ScRRI(); break; case ocZW : ScZW(); break; case ocZZR : ScZZR(); break; case ocZins : ScZins(); break; diff --git a/main/sc/source/core/tool/parclass.cxx b/main/sc/source/core/tool/parclass.cxx index 972874478d..6159ae23eb 100644 --- a/main/sc/source/core/tool/parclass.cxx +++ b/main/sc/source/core/tool/parclass.cxx @@ -571,8 +571,8 @@ void ScParameterClassification::GenerateDocumentation() aStr += ")"; switch ( eOp ) { - case ocZGZ: - aStr += " // RRI in English resource, but ZGZ in English-only section"; + case ocRRI: + aStr += " // RRI in English resource"; break; case ocMultiArea: aStr += " // e.g. combined first parameter of INDEX() function, not a real function"; diff --git a/main/sc/source/filter/excel/xlformula.cxx b/main/sc/source/filter/excel/xlformula.cxx index 86391547fa..15a1fd30c9 100644 --- a/main/sc/source/filter/excel/xlformula.cxx +++ b/main/sc/source/filter/excel/xlformula.cxx @@ -419,7 +419,7 @@ static const XclFunctionInfo saFuncTable_Odf[] = EXC_FUNCENTRY_ODF( ocLaufz, 3, 3, 0, "PDURATION" ), EXC_FUNCENTRY_ODF( ocVariationen2, 2, 2, 0, "PERMUTATIONA" ), EXC_FUNCENTRY_ODF( ocPhi, 1, 1, 0, "PHI" ), - EXC_FUNCENTRY_ODF( ocZGZ, 3, 3, 0, "RRI" ), + EXC_FUNCENTRY_ODF( ocRRI, 3, 3, 0, "RRI" ), EXC_FUNCENTRY_ODF( ocTable, 0, 1, 0, "SHEET" ), EXC_FUNCENTRY_ODF( ocTables, 0, 1, 0, "SHEETS" ), EXC_FUNCENTRY_ODF( ocUnichar, 1, 1, 0, "UNICHAR" ), diff --git a/main/sc/source/filter/qpro/qproform.cxx b/main/sc/source/filter/qpro/qproform.cxx index da3f1a62ce..ac925f5c30 100644 --- a/main/sc/source/filter/qpro/qproform.cxx +++ b/main/sc/source/filter/qpro/qproform.cxx @@ -149,7 +149,7 @@ void QProToSc::DoFunc( DefTokenId eOc, sal_uInt16 nArgs, const sal_Char* pExtStr sal_Int16 nNull = -1; sal_Int16 nLast = nArgs- 1; - if( eOc == ocZGZ ) + if( eOc == ocRRI ) aPool << eParam[ 2 ] << ocSep << eParam[ 1 ] << ocSep << eParam[ 0 ]; if( eOc == ocZinsZ ) aPool << eParam[ 3 ] << ocSep << eParam[ 2 ] << ocSep << eParam[ 1 ] << ocSep << eParam[ 0 ]; @@ -504,7 +504,7 @@ static const struct { ocExact, FT_FuncFix2 }, { ocNoName, FT_NotImpl }, // Call() { ocIndirect, FT_FuncFix1 }, - { ocZGZ, FT_FuncFix3 }, // Interest + { ocRRI, FT_FuncFix3 }, // Interest { ocNoName, FT_NotImpl }, { ocNoName, FT_NotImpl }, { ocLIA, FT_FuncFix3 }, diff --git a/main/sc/source/ui/src/scfuncs.src b/main/sc/source/ui/src/scfuncs.src index 068af1811e..b9dc176a4b 100644 --- a/main/sc/source/ui/src/scfuncs.src +++ b/main/sc/source/ui/src/scfuncs.src @@ -2184,8 +2184,8 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 Text [ en-US ] = "The future value of the investment." ; }; }; - // -=*# Resource for function ZGZ #*=- - Resource SC_OPCODE_ZGZ + // -=*# Resource for function RRI #*=- + Resource SC_OPCODE_RRI { String 1 // Description { @@ -2195,7 +2195,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 { 0; ID_FUNCTION_GRP_FINANZ; - U2S( HID_FUNC_ZGZ ); + U2S( HID_FUNC_RRI ); 3; 0; 0; 0; 0; }; @@ -2209,7 +2209,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 }; String 4 // Name of Parameter 2 { - Text [ en-US ] = "pv" ; + Text [ en-US ] = "PV" ; }; String 5 // Description of Parameter 2 { diff --git a/main/sc/util/hidother.src b/main/sc/util/hidother.src index 6380b0318a..87dd143369 100644 --- a/main/sc/util/hidother.src +++ b/main/sc/util/hidother.src @@ -134,6 +134,7 @@ hidspecial HID_FUNC_QIKV { HelpID = HID_FUNC_QIKV; }; hidspecial HID_FUNC_ISPMT { HelpID = HID_FUNC_ISPMT; }; hidspecial HID_FUNC_LAUFZEIT { HelpID = HID_FUNC_LAUFZEIT; }; hidspecial HID_FUNC_ZGZ { HelpID = HID_FUNC_ZGZ; }; +hidspecial HID_FUNC_RRI { HelpID = HID_FUNC_RRI; }; hidspecial HID_FUNC_ISTBEZUG { HelpID = HID_FUNC_ISTBEZUG; }; hidspecial HID_FUNC_ISTFEHL { HelpID = HID_FUNC_ISTFEHL; }; hidspecial HID_FUNC_ISTFEHLER { HelpID = HID_FUNC_ISTFEHLER; };
