diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-14 14:46:59 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-14 17:18:59 -0500 |
commit | 75d807f7b1cc9aa2ef3cf41d6f572aa5a56583a7 (patch) | |
tree | 6eb113348effdc106ad8b44b73317f4af8fc1d59 /sc | |
parent | 7cec5493cebfb0833389ea79cb83fbc677c6751c (diff) |
Try to preserve the orientation of data layout dimension.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/dbgui/pvlaydlg.cxx | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx index 8b83f6b06834..2c27c1a9e505 100644 --- a/sc/source/ui/dbgui/pvlaydlg.cxx +++ b/sc/source/ui/dbgui/pvlaydlg.cxx @@ -1447,14 +1447,31 @@ bool ScDPLayoutDlg::GetPivotArrays( vector<PivotField> aColFields; for_each(aColArr.begin(), aColArr.end(), PivotFieldInserter(aColFields, aColArr.size())); - // default data pilot table always has an extra row field as a data layout field. vector<PivotField> aRowFields; for_each(aRowArr.begin(), aRowArr.end(), PivotFieldInserter(aRowFields, aRowArr.size()+1)); - aRowFields.push_back(PivotField(PIVOT_DATA_FIELD, 0)); vector<PivotField> aDataFields; for_each(aDataArr.begin(), aDataArr.end(), PivotFieldInserter(aDataFields, aDataArr.size())); + sheet::DataPilotFieldOrientation eOrientDataLayout = sheet::DataPilotFieldOrientation_ROW; + ScDPSaveData* pSaveData = xDlgDPObject->GetSaveData(); + if (pSaveData) + { + const ScDPSaveDimension* p = pSaveData->GetExistingDataLayoutDimension(); + if (p) + // Try to preserve the orientation of existing data layout dimension. + eOrientDataLayout = static_cast<sheet::DataPilotFieldOrientation>(p->GetOrientation()); + } + switch (eOrientDataLayout) + { + case sheet::DataPilotFieldOrientation_COLUMN: + aColFields.push_back(PivotField(PIVOT_DATA_FIELD, 0)); + break; + default: + // data layout dimension can only be row or column. + aRowFields.push_back(PivotField(PIVOT_DATA_FIELD, 0)); + } + rPageFields.swap(aPageFields); rColFields.swap(aColFields); rRowFields.swap(aRowFields); |