diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-25 00:42:02 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-25 00:45:43 -0500 |
commit | 1fb5aea16f11c90aaac23486e584a17e0655b621 (patch) | |
tree | e0026f0846c344d3b0c05c01fbe0069b4f35f068 /sc/source | |
parent | 778a6993b971f13f4008491f54296e57b9026238 (diff) |
Show column/row grand totals only when at least one column/row field exists.
Otherwise the grand total would be just a duplicate of the data field
area.
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/dptabsrc.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index 22f17effa857..24dc55f4cfa0 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -863,8 +863,15 @@ void ScDPSource::CreateRes_Impl() aInitState.AddMember( nPageDims[i], GetMemberId( nPageDims[i], pDim->GetSelectedData() ) ); } - pColResRoot = new ScDPResultMember( pResData, bColumnGrand ); - pRowResRoot = new ScDPResultMember( pResData, bRowGrand ); + // Show grand total columns only when the option is set *and* there is at + // least one column field. Same for the grand total rows. + sal_uInt16 nDataLayoutOrient = GetDataLayoutOrientation(); + long nColDimCount2 = nColDimCount - (nDataLayoutOrient == sheet::DataPilotFieldOrientation_COLUMN ? 1 : 0); + long nRowDimCount2 = nRowDimCount - (nDataLayoutOrient == sheet::DataPilotFieldOrientation_ROW ? 1 : 0); + bool bShowColGrand = bColumnGrand && nColDimCount2 > 0; + bool bShowRowGrand = bRowGrand && nRowDimCount2 > 0; + pColResRoot = new ScDPResultMember(pResData, bShowColGrand); + pRowResRoot = new ScDPResultMember(pResData, bShowRowGrand); FillCalcInfo(false, aInfo, bHasAutoShow); long nColLevelCount = aInfo.aColLevels.size(); |