[Libreoffice-commits] .: chart2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Sep 24 16:26:49 PDT 2012


 chart2/source/tools/ExplicitCategoriesProvider.cxx |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 8baaff5c798984b0fa7fe7a764491ca27765623e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Sep 24 16:09:10 2012 -0400

    fdo#55298: We should only treat empty values as continuation of previous ones.
    
    For better Excel compatibility.
    
    Change-Id: I3bc44f65127d3f020894dc29e5c6549bb257f218

diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index 5bb991a..9cc82b6 100644
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -284,7 +284,7 @@ std::vector< ComplexCategory > lcl_DataSequenceToComplexCategoryVector(
     sal_Int32 nCurrentCount=0;
     for( sal_Int32 nN=0; nN<nMaxCount; nN++ )
     {
-        OUString aCurrent = rStrings[nN];
+        const OUString& aCurrent = rStrings[nN];
         if( bCreateSingleCategories || ::std::find( rLimitingBorders.begin(), rLimitingBorders.end(), nN ) != rLimitingBorders.end() )
         {
             aResult.push_back( ComplexCategory(aPrevious,nCurrentCount) );
@@ -293,14 +293,18 @@ std::vector< ComplexCategory > lcl_DataSequenceToComplexCategoryVector(
         }
         else
         {
-            if( !aCurrent.isEmpty() && aPrevious != aCurrent )
+            // Empty value is interpreted as a continuation of the previous
+            // category. Note that having the same value as the previous one
+            // does not equate to a continuation of the category.
+
+            if (aCurrent.isEmpty())
+                ++nCurrentCount;
+            else
             {
                 aResult.push_back( ComplexCategory(aPrevious,nCurrentCount) );
                 nCurrentCount=1;
                 aPrevious = aCurrent;
             }
-            else
-                nCurrentCount++;
         }
     }
     if( nCurrentCount )


More information about the Libreoffice-commits mailing list