[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/inc sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Wed Jan 8 05:29:28 PST 2014


 sc/inc/dputil.hxx                 |    2 +-
 sc/source/core/data/dpdimsave.cxx |    4 ++--
 sc/source/core/data/dpgroup.cxx   |    2 +-
 sc/source/core/data/dputil.cxx    |   13 ++++++++-----
 4 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 06a5bad8e1feb1972059d4f9c4d89eb59ae43ae2
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Jan 7 22:13:07 2014 -0500

    fdo#72774: Generate correct group items for the year group.
    
    This changes bring it back to the same algorithm used in 3.5.
    
    Change-Id: I16855cef1de133a1f886baa823d5b0d2b148e781
    (cherry picked from commit c2e88a32314012afb799e321ec1d658f99f71781)
    Reviewed-on: https://gerrit.libreoffice.org/7305
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/inc/dputil.hxx b/sc/inc/dputil.hxx
index e4ed831..9568e95 100644
--- a/sc/inc/dputil.hxx
+++ b/sc/inc/dputil.hxx
@@ -45,7 +45,7 @@ public:
         SvNumberFormatter* pFormatter);
 
     static sal_Int32 getDatePartValue(
-        double fValue, const ScDPNumGroupInfo& rInfo, sal_Int32 nDatePart,
+        double fValue, const ScDPNumGroupInfo* pInfo, sal_Int32 nDatePart,
         SvNumberFormatter* pFormatter);
 
     static OUString getDisplayedMeasureName(const OUString& rName, ScSubTotalFunc eFunc);
diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx
index d200971..3f51268 100644
--- a/sc/source/core/data/dpdimsave.cxx
+++ b/sc/source/core/data/dpdimsave.cxx
@@ -337,8 +337,8 @@ void fillDateGroupDimension(
     {
         case sheet::DataPilotFieldGroupBy::YEARS:
             nStart = ScDPUtil::getDatePartValue(
-                fSourceMin, rDateInfo, sheet::DataPilotFieldGroupBy::YEARS, pFormatter);
-            nEnd = ScDPUtil::getDatePartValue(fSourceMax, rDateInfo, sheet::DataPilotFieldGroupBy::YEARS, pFormatter);
+                fSourceMin, NULL, sheet::DataPilotFieldGroupBy::YEARS, pFormatter);
+            nEnd = ScDPUtil::getDatePartValue(fSourceMax, NULL, sheet::DataPilotFieldGroupBy::YEARS, pFormatter);
             break;
         case sheet::DataPilotFieldGroupBy::QUARTERS: nStart = 1; nEnd = 4;   break;
         case sheet::DataPilotFieldGroupBy::MONTHS:   nStart = 1; nEnd = 12;  break;
diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx
index f79a740..e5da799 100644
--- a/sc/source/core/data/dpgroup.cxx
+++ b/sc/source/core/data/dpgroup.cxx
@@ -911,7 +911,7 @@ void ScDPGroupTableData::FillGroupValues(vector<SCROW>& rItems, const vector<lon
             {
                 SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
                 sal_Int32 nPartValue = ScDPUtil::getDatePartValue(
-                    pData->GetValue(), *pNumInfo, nDatePart, pFormatter);
+                    pData->GetValue(), pNumInfo, nDatePart, pFormatter);
 
                 ScDPItemData aItem(nDatePart, nPartValue);
                 rItems[i] = pCache->GetIdByItemData(nColumn, aItem);
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index e21b2a8..03f585c 100644
--- a/sc/source/core/data/dputil.cxx
+++ b/sc/source/core/data/dputil.cxx
@@ -290,16 +290,19 @@ OUString ScDPUtil::getNumGroupName(
 }
 
 sal_Int32 ScDPUtil::getDatePartValue(
-    double fValue, const ScDPNumGroupInfo& rInfo, sal_Int32 nDatePart,
+    double fValue, const ScDPNumGroupInfo* pInfo, sal_Int32 nDatePart,
     SvNumberFormatter* pFormatter)
 {
     // Start and end are inclusive
     // (End date without a time value is included, with a time value it's not)
 
-    if (fValue < rInfo.mfStart && !rtl::math::approxEqual(fValue, rInfo.mfStart))
-        return ScDPItemData::DateFirst;
-    if (fValue > rInfo.mfEnd && !rtl::math::approxEqual(fValue, rInfo.mfEnd))
-        return ScDPItemData::DateLast;
+    if (pInfo)
+    {
+        if (fValue < pInfo->mfStart && !rtl::math::approxEqual(fValue, pInfo->mfStart))
+            return ScDPItemData::DateFirst;
+        if (fValue > pInfo->mfEnd && !rtl::math::approxEqual(fValue, pInfo->mfEnd))
+            return ScDPItemData::DateLast;
+    }
 
     sal_Int32 nResult = 0;
 


More information about the Libreoffice-commits mailing list