tdf#50950 sort out Calc (ISO)WEEKNUM functions

Winfried Donkers W.Donkers at
Fri Sep 18 04:13:43 PDT 2015

Hi Eike,

> The proper place to use that if the formula string is already compiled is
> in the RPN code generation formula/source/core/api/FormulaCompiler.cxx
> FormulaCompiler::Factor() where in line 1177 there's also an example of
> the NewOpCode() usage
>     pFacToken->NewOpCode( ocUnion, FormulaToken::PrivateAccess());
> In the long else{} branch there's
>     else if ((SC_OPCODE_START_2_PAR <= eOp && eOp < SC_OPCODE_STOP_2_PAR)
>         ...
> and there at the end a pFacToken->SetByte( nSepCount ); followed by a
> PutCode( pFacToken ); Before the PutCode(), when compiling ODFF and the
> pFacToken's OpCode is ocIsoWeeknum and nSepCount==2 (actually nSepCount is
> the argument count) you could do
>     pFacToken->NewOpCode( ocWeek, FormulaToken::PrivateAccess());

Except ISOWEEKNUM is a 1-parameter function, so I had to add some more code to make it work.
And work it does (it passes the umodified unit test, which proves it works).
Thank you for your hint :)

I can continue with the patch.


More information about the LibreOffice mailing list