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

Try to preserve the orientation of data layout dimension.

üst 7cec5493
......@@ -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);
......
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