improve performance of cell equality comparisons (tdf#139444)

When comparing cell and a string for (in)equality, that means
comparing the whole cell, even when not explicitly asked for.
Whole cell comparison is simpler and faster.

Change-Id: Ic7a79b20f710f2a5d84f62c714d67c088a22d449
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124881
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 9c74172..02c2619 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2705,6 +2705,12 @@ public:
            // Simple string matching i.e. no regexp match.
            if (isTextMatchOp(rEntry))
            {
                bool matchWholeCell = bMatchWholeCell;
                // When comparing for (in)equality, we can simply compare the whole cell
                // even when not explicitly asked, and that code is faster (it's simpler,
                // no SharedString temporary, etc.).
                if( rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL )
                    matchWholeCell = true;
                if (rItem.meType != ScQueryEntry::ByString && rItem.maString.isEmpty())
                {
                    // #i18374# When used from functions (match, countif, sumif, vlookup, hlookup, lookup),
@@ -2714,7 +2720,7 @@ public:
                    if ( rEntry.eOp == SC_NOT_EQUAL )
                        bOk = !bOk;
                }
                else if ( bMatchWholeCell )
                else if ( matchWholeCell )
                {
                    if (pValueSource1)
                    {
@@ -2752,7 +2758,7 @@ public:
                    sal_Int32 nStrPos;

                    if (!mbCaseSensitive)
                    { // Common case for vlookup etc.
                    {
                        const svl::SharedString rSource(pValueSource1? *pValueSource1 : mrStrPool.intern(*pValueSource2));

                        const rtl_uString *pQuer = rItem.maString.getDataIgnoreCase();