[Libreoffice-commits] core.git: Branch 'feature/cib_contract138' - 2 commits - sc/source

Eike Rathke erack at redhat.com
Wed May 17 13:36:54 UTC 2017


 sc/source/core/data/dociter.cxx  |   22 ++++++++++++++--------
 sc/source/core/tool/interpr4.cxx |    5 +++++
 2 files changed, 19 insertions(+), 8 deletions(-)

New commits:
commit 53dcc323db200ba440f5cdb054bce8bd126b4185
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Feb 11 23:44:00 2015 +0100

    Resolves: tdf#39316 add matrix empty cells to ScInterpreter::QueryMatrixType()
    
    (only partial cherry-pick, ScMatrix::IsEmptyResult needs newer mdds)
    (cherry picked from commit eccbc97c7c224269fe261b8924e7866c3758ec91)
    
    Change-Id: Ifa5d59e90afcfff66f2e8683fac2a9090ed615da

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 7d7e5b9575c2..2995a6e18c65 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1849,6 +1849,11 @@ void ScInterpreter::QueryMatrixType(ScMatrixRef& xMat, short& rRetTypeExpr, sal_
                 PushTempToken( new ScMatrixCellResultToken( xMat, xRes.get()));
                 rRetTypeExpr = NUMBERFORMAT_LOGICAL;
             }
+            else if ( xMat->IsEmpty( 0, 0))
+            {   // empty or empty cell
+                FormulaTokenRef xRes = new ScEmptyCellToken( false, true);  // not inherited, display empty
+                PushTempToken( new ScMatrixCellResultToken( xMat, xRes.get()));
+            }
             else
             {
                 String aStr( nMatVal.GetString());
commit 0f420e946b48cb5fea0302f6fbfbded3f6d50560
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Mon Apr 3 16:36:11 2017 +0200

    tdf#35636: Apply algorithm also to ranges spanning multiple columns
    
    Change-Id: I6e574f2237dd6d4dcf4438a9fdafadb66aa049c5

diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index d31f17038b26..16c6d1fee94f 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -57,8 +57,16 @@ namespace
         rStr = ScGlobal::pCharClass->uppercase(rStr.trim());
     }
 
-    void lcl_FillBlankCells( std::vector<ColEntry> &rSrcCols, std::vector<ColEntry> &rDestCols, SCROW nLastRow )
+    void lcl_FillBlankCells( std::vector<ColEntry> &rSrcCols, std::vector<ColEntry> &rDestCols, SCROW nLastRow, bool bMatchEmpty )
     {
+        rDestCols.clear();
+
+        if (!bMatchEmpty)
+        {
+            rDestCols = rSrcCols;
+            return;
+        }
+
         for( SCROW i = 0, n = 0; i <= nLastRow; ++i )
         {
             rDestCols.push_back(ColEntry());
@@ -1214,13 +1222,8 @@ bool ScQueryCellIterator::GetThis()
     bool bMatchEmpty = ( rItem.mbMatchEmpty && rEntry.GetQueryItems().size() == 1 );
 
     std::vector<ColEntry> rColItems;
-    if ( !bMatchEmpty )
-        rColItems = pCol->maItems;
-    else
-    {
-       SCROW nLastRow = pCol->maItems.back().nRow;
-       lcl_FillBlankCells( pCol->maItems, rColItems, std::max(nLastRow, mpParam->nRow2) );
-    }
+    SCROW nLastRow = pCol->GetLastDataPos();
+    lcl_FillBlankCells( pCol->maItems, rColItems, std::max(nLastRow, mpParam->nRow2), bMatchEmpty );
 
     for ( ;; )
     {
@@ -1238,7 +1241,10 @@ bool ScQueryCellIterator::GetThis()
                     AdvanceQueryParamEntryField();
                     nFirstQueryField = rEntry.nField;
                 }
+
                 pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
+                nLastRow = pCol->GetLastDataPos();
+                lcl_FillBlankCells( pCol->maItems, rColItems, std::max(nLastRow, mpParam->nRow2), bMatchEmpty );
             } while ( pCol->maItems.empty() );
             pCol->Search( nRow, nColRow );
             bFirstStringIgnore = bIgnoreMismatchOnLeadingStrings &&


More information about the Libreoffice-commits mailing list