summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-02-14 22:54:15 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-02-14 22:54:51 -0500
commitd2668a9118a20c62e28cf064c5c625f096a9c20d (patch)
tree899ce201d7227dcac16dfeb8fc84bf005f9b014c /sc
parent5e4b9d960e88b6137d952845fe121836e73f3ca3 (diff)
Fix subsequentcheck. We need to have at least one measure data at all times.
Change-Id: I9ffe6a1cedc91fb0829b074097aa774f8eae8d88
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/dptabres.cxx37
1 files changed, 33 insertions, 4 deletions
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 7d571bbc553b..bb867aa0a839 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -732,10 +732,39 @@ void ScDPResultData::SetMeasureData(
std::vector<ScSubTotalFunc>& rFunctions, std::vector<sheet::DataPilotFieldReference>& rRefs,
std::vector<sal_uInt16>& rRefOrient, std::vector<OUString>& rNames )
{
- maMeasureFuncs.swap(rFunctions);
- maMeasureRefs.swap(rRefs);
- maMeasureRefOrients.swap(rRefOrient);
- maMeasureNames.swap(rNames);
+ // We need to have at least one measure data at all times.
+
+ if (rFunctions.empty())
+ {
+ std::vector<ScSubTotalFunc> aDummy(1, SUBTOTAL_FUNC_NONE);
+ maMeasureFuncs.swap(aDummy);
+ }
+ else
+ maMeasureFuncs.swap(rFunctions);
+
+ if (rRefs.empty())
+ {
+ std::vector<sheet::DataPilotFieldReference> aDummy(1); // default ctor is ok.
+ maMeasureRefs.swap(aDummy);
+ }
+ else
+ maMeasureRefs.swap(rRefs);
+
+ if (rRefOrient.empty())
+ {
+ std::vector<sal_uInt16> aDummy(1, sheet::DataPilotFieldOrientation_HIDDEN);
+ maMeasureRefOrients.swap(aDummy);
+ }
+ else
+ maMeasureRefOrients.swap(rRefOrient);
+
+ if (rNames.empty())
+ {
+ std::vector<OUString> aDummy(1, ScGlobal::GetRscString(STR_EMPTYDATA));
+ maMeasureNames.swap(aDummy);
+ }
+ else
+ maMeasureNames.swap(rNames);
}
void ScDPResultData::SetDataLayoutOrientation( sal_uInt16 nOrient )