Kaydet (Commit) c2e88a32 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

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
üst d930cefb
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment