[Libreoffice-commits] core.git: sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Fri Feb 15 07:51:38 PST 2013


 sc/source/core/data/dptabres.cxx |   40 +++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

New commits:
commit 1577fe0bad673fea0814c6db91ad5466c819306d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Feb 14 23:05:16 2013 -0500

    This one is less awkward.
    
    Change-Id: I3bb9555ff4db6728a9a50ee5459faf981232445a

diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index e539598..c21c5c1 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -734,37 +734,21 @@ void ScDPResultData::SetMeasureData(
 {
     // 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);
+    maMeasureFuncs.swap(rFunctions);
+    if (maMeasureFuncs.empty())
+        maMeasureFuncs.push_back(SUBTOTAL_FUNC_NONE);
 
-    if (rRefs.empty())
-    {
-        std::vector<sheet::DataPilotFieldReference> aDummy(1); // default ctor is ok.
-        maMeasureRefs.swap(aDummy);
-    }
-    else
-        maMeasureRefs.swap(rRefs);
+    maMeasureRefs.swap(rRefs);
+    if (maMeasureRefs.empty())
+        maMeasureRefs.push_back(sheet::DataPilotFieldReference()); // default ctor is ok.
 
-    if (rRefOrient.empty())
-    {
-        std::vector<sal_uInt16> aDummy(1, sheet::DataPilotFieldOrientation_HIDDEN);
-        maMeasureRefOrients.swap(aDummy);
-    }
-    else
-        maMeasureRefOrients.swap(rRefOrient);
+    maMeasureRefOrients.swap(rRefOrient);
+    if (maMeasureRefOrients.empty())
+        maMeasureRefOrients.push_back(sheet::DataPilotFieldOrientation_HIDDEN);
 
-    if (rNames.empty())
-    {
-        std::vector<OUString> aDummy(1, ScGlobal::GetRscString(STR_EMPTYDATA));
-        maMeasureNames.swap(aDummy);
-    }
-    else
-        maMeasureNames.swap(rNames);
+    maMeasureNames.swap(rNames);
+    if (maMeasureNames.empty())
+        maMeasureNames.push_back(ScGlobal::GetRscString(STR_EMPTYDATA));
 }
 
 void ScDPResultData::SetDataLayoutOrientation( sal_uInt16 nOrient )


More information about the Libreoffice-commits mailing list