[Libreoffice-commits] core.git: sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Thu Feb 14 19:53:13 PST 2013
sc/source/core/data/dptabres.cxx | 37 +++++++++++++++++++++++++++++++++----
1 file changed, 33 insertions(+), 4 deletions(-)
New commits:
commit d2668a9118a20c62e28cf064c5c625f096a9c20d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Feb 14 22:54:15 2013 -0500
Fix subsequentcheck. We need to have at least one measure data at all times.
Change-Id: I9ffe6a1cedc91fb0829b074097aa774f8eae8d88
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 7d571bb..bb867aa 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 )
More information about the Libreoffice-commits
mailing list