diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-07 22:13:07 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-07 23:02:15 -0500 |
commit | c2e88a32314012afb799e321ec1d658f99f71781 (patch) | |
tree | 901d035d1216b110e7d82d718ba46c4228306be9 /sc/source | |
parent | d930cefbe65d8b7f21100fcbf2ddcd977dd15cb1 (diff) |
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
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/dpdimsave.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/dpgroup.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dputil.cxx | 13 |
3 files changed, 11 insertions, 8 deletions
diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx index d200971d50ab..3f51268c91ff 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 f79a7403e5f0..e5da7993859c 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 14b8639579b4..73fc4d775b22 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; |