[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sc/source

Eike Rathke erack at redhat.com
Mon Jan 18 13:45:44 PST 2016


 sc/source/core/tool/interpr2.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 3665652285f29021f4a12cc493fe8791b6afc126
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jan 5 15:42:27 2016 +0100

    tdf#96198 accept WEEKNUM with only one parameter, tdf#50950 follow-up
    
    Loading ISOWEEKNUM(date) maps to WEEKNUM(date) so accept the actual
    ISOWEEKNUM parameter count defined in ODFF. This also ensures forward
    compatibility with 5.1 where 3e5deb8ccfaf0b73fb6cf394822e560dc036a686
    (cherry picked from commit 15494f0f99d1cf6f75e8c2996377b242af247bbf)
    converts ISOWEEKNUM(date,mode) to real ISOWEEKNUM(date) if mode!=1 as
    there is no matching WEEKNUM(date,mode) defined. This WEEKNUM here never
    implemented the ODFF WEEKNUM but a mix of ISOWEEKNUM and something
    undefined different.
    
    Change-Id: Ibd0d4483486a1db28cc600821baae9f13b9dd687
    Reviewed-on: https://gerrit.libreoffice.org/21118
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 84a5bff..d82bc29 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -207,9 +207,12 @@ void ScInterpreter::ScGetDayOfWeek()
 
 void ScInterpreter::ScGetWeekOfYear()
 {
-    if ( MustHaveParamCount( GetByte(), 2 ) )
+    sal_uInt8 nParamCount = GetByte();
+    if ( MustHaveParamCount( nParamCount, 1, 2 ) )
     {
-        short nFlag = (short) ::rtl::math::approxFloor(GetDouble());
+        // Without mode parameter calculate ISO 8601 week starting on Monday
+        // like ISOWEEKNUM(), which this is loaded from.
+        short nFlag = (nParamCount == 1) ? 0 : (short) ::rtl::math::approxFloor(GetDouble());
 
         Date aDate = *(pFormatter->GetNullDate());
         aDate += (long)::rtl::math::approxFloor(GetDouble());


More information about the Libreoffice-commits mailing list