[Libreoffice-commits] .: Branch 'feature/calc-dbrange-ref' - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 25 12:05:18 PDT 2012


Rebased ref, commits from common ancestor:
commit 4f6fcb95b02951d41191eab15402650f7986cf7a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Sep 25 15:03:19 2012 -0400

    Support opcodes 101 through 111 in SUBTOTAL.
    
    Excel 2007 supports them.  So should we.
    
    Change-Id: I17253bc043bdcce451ee0a7ccf494ed0f84bf3cd

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 876748c..68269a3 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -6578,10 +6578,20 @@ void ScInterpreter::ScSubTotal()
         const FormulaToken* p = pStack[ sp - nParamCount ];
         PushTempToken( *p );
         int nFunc = (int) ::rtl::math::approxFloor( GetDouble() );
+        bool bIncludeHidden = true;
+        if (nFunc > 100)
+        {
+            // For opcodes 101 through 111, we need to skip hidden cells.
+            // Other than that these opcodes are identical to 1 through 11.
+            bIncludeHidden = false;
+            nFunc -= 100;
+        }
+
         if( nFunc < 1 || nFunc > 11 )
             PushIllegalArgument();  // simulate return on stack, not SetError(...)
         else
         {
+            // TODO: Make use of bIncludeHidden flag. Then it's false, we do need to skip hidden cells.
             cPar = nParamCount - 1;
             glSubTotal = true;
             switch( nFunc )


More information about the Libreoffice-commits mailing list