[Libreoffice-commits] core.git: 3 commits - sc/inc sc/Library_sc.mk sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Wed Feb 13 15:01:04 PST 2013


 sc/Library_sc.mk                        |    1 
 sc/inc/dpfilteredcache.hxx              |    4 +--
 sc/inc/dpglobal.hxx                     |   12 ++++++++++
 sc/inc/dpitemdata.hxx                   |    3 +-
 sc/inc/dptabdat.hxx                     |   20 ----------------
 sc/inc/dptabres.hxx                     |   14 +++++------
 sc/inc/subtotal.hxx                     |    9 +++----
 sc/source/core/data/dpfilteredcache.cxx |    8 +++---
 sc/source/core/data/dpglobal.cxx        |   20 ++++++++++++++++
 sc/source/core/data/dpitemdata.cxx      |   10 ++++----
 sc/source/core/data/dptabdat.cxx        |    4 +--
 sc/source/core/data/dptabres.cxx        |   38 ++++++++++++++++----------------
 sc/source/core/tool/subtotal.cxx        |   14 +++++------
 13 files changed, 85 insertions(+), 72 deletions(-)

New commits:
commit 603262b7d19da53eeb7235f6fa460777825c0ddf
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Feb 13 17:45:26 2013 -0500

    sal_Bool to bool.
    
    Change-Id: I2599e12a9072a0ea34c62a9fd7982dd4630c329f

diff --git a/sc/inc/subtotal.hxx b/sc/inc/subtotal.hxx
index 4432868..379bf10 100644
--- a/sc/inc/subtotal.hxx
+++ b/sc/inc/subtotal.hxx
@@ -25,10 +25,9 @@
 class SubTotal
 {
 public:
-
-    static  sal_Bool SafePlus( double& fVal1, double fVal2);
-    static  sal_Bool SafeMult( double& fVal1, double fVal2);
-    static  sal_Bool SafeDiv( double& fVal1, double fVal2);
+    static bool SafePlus( double& fVal1, double fVal2);
+    static bool SafeMult( double& fVal1, double fVal2);
+    static bool SafeDiv( double& fVal1, double fVal2);
 };
 
 
@@ -37,7 +36,7 @@ struct ScFunctionData                   // to calculate single functions
     ScSubTotalFunc  eFunc;
     double          nVal;
     long            nCount;
-    sal_Bool            bError;
+    bool            bError;
 
     ScFunctionData( ScSubTotalFunc eFn ) :
         eFunc(eFn), nVal(0.0), nCount(0), bError(false) {}
diff --git a/sc/source/core/tool/subtotal.cxx b/sc/source/core/tool/subtotal.cxx
index 659369d..b5d2539 100644
--- a/sc/source/core/tool/subtotal.cxx
+++ b/sc/source/core/tool/subtotal.cxx
@@ -20,11 +20,9 @@
 #include "subtotal.hxx"
 #include "interpre.hxx"
 
-// -----------------------------------------------------------------------
-
-sal_Bool SubTotal::SafePlus(double& fVal1, double fVal2)
+bool SubTotal::SafePlus(double& fVal1, double fVal2)
 {
-    sal_Bool bOk = sal_True;
+    bool bOk = true;
     SAL_MATH_FPEXCEPTIONS_OFF();
     fVal1 += fVal2;
     if (!::rtl::math::isFinite(fVal1))
@@ -39,9 +37,9 @@ sal_Bool SubTotal::SafePlus(double& fVal1, double fVal2)
 }
 
 
-sal_Bool SubTotal::SafeMult(double& fVal1, double fVal2)
+bool SubTotal::SafeMult(double& fVal1, double fVal2)
 {
-    sal_Bool bOk = sal_True;
+    bool bOk = true;
     SAL_MATH_FPEXCEPTIONS_OFF();
     fVal1 *= fVal2;
     if (!::rtl::math::isFinite(fVal1))
@@ -53,9 +51,9 @@ sal_Bool SubTotal::SafeMult(double& fVal1, double fVal2)
 }
 
 
-sal_Bool SubTotal::SafeDiv(double& fVal1, double fVal2)
+bool SubTotal::SafeDiv(double& fVal1, double fVal2)
 {
-    sal_Bool bOk = sal_True;
+    bool bOk = true;
     SAL_MATH_FPEXCEPTIONS_OFF();
     fVal1 /= fVal2;
     if (!::rtl::math::isFinite(fVal1))
commit 623253418b3fc18a8122ea1f71e86628208000ff
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Feb 13 17:40:27 2013 -0500

    ScDPValueData->ScDPValue. The last 'Data' sounds very redundant.
    
    Change-Id: I218315a0583ce6b0f10969b364a7a717ad309212

diff --git a/sc/inc/dpfilteredcache.hxx b/sc/inc/dpfilteredcache.hxx
index 9caa2f8..206b6ba 100644
--- a/sc/inc/dpfilteredcache.hxx
+++ b/sc/inc/dpfilteredcache.hxx
@@ -36,7 +36,7 @@ class ScDPItemData;
 class ScDPCache;
 class ScDocument;
 class ScRange;
-struct ScDPValueData;
+struct ScDPValue;
 struct ScQueryParam;
 
 /**
@@ -123,7 +123,7 @@ public:
         that the data grid doesn't include the header row.  Don't delete the
         returned object! */
     const ScDPItemData* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const;
-    void  getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const;
+    void  getValue( ScDPValue& rVal, SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const;
     rtl::OUString getFieldName(SCCOL nIndex) const;
 
    /** Get the unique entries for a field specified by index.  The caller must
diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx
index 6fffc64..74250a6 100644
--- a/sc/inc/dpglobal.hxx
+++ b/sc/inc/dpglobal.hxx
@@ -35,14 +35,14 @@
 #define     PIVOT_FUNC_STD_VARP     0x0400
 #define     PIVOT_FUNC_AUTO         0x1000
 
-struct ScDPValueData
+struct ScDPValue
 {
     enum Type { Empty = 0, Value, String, Error };
 
     double mfValue;
     Type meType;
 
-    ScDPValueData();
+    ScDPValue();
 
     void Set( double fV, Type eT );
 };
diff --git a/sc/inc/dpitemdata.hxx b/sc/inc/dpitemdata.hxx
index bd33607..e064d25 100644
--- a/sc/inc/dpitemdata.hxx
+++ b/sc/inc/dpitemdata.hxx
@@ -110,7 +110,7 @@ public:
     GroupValueAttr GetGroupValue() const;
     bool HasStringData() const ;
 
-    ScDPValueData::Type GetCellType() const;
+    ScDPValue::Type GetCellType() const;
 
 #if DEBUG_PIVOT_TABLE
     void Dump(const char* msg) const;
diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx
index 7c6dd33..e1924ac 100644
--- a/sc/inc/dptabdat.hxx
+++ b/sc/inc/dptabdat.hxx
@@ -157,7 +157,7 @@ protected:
         ::std::vector< SCROW >  aColData;
         ::std::vector< SCROW >  aRowData;
         ::std::vector< SCROW >  aPageData;
-        ::std::vector<ScDPValueData> aValues;
+        ::std::vector<ScDPValue> aValues;
     };
 
     void            FillRowDataFromCacheTable(sal_Int32 nRow, const ScDPFilteredCache& rCacheTable, const CalcInfo& rInfo, CalcRowData& rData);
diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index edef1b3..4321651 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -49,7 +49,7 @@ class ScDPAggData;
 class ScDPResultMember;
 class ScDPResultVisibilityData;
 
-struct ScDPValueData;
+struct ScDPValue;
 class ScDPItemData;
 
 /**
@@ -168,7 +168,7 @@ public:
             ScDPAggData() : fVal(0.0), fAux(0.0), nCount(SC_DPAGG_EMPTY), pChild(NULL) {}
             ~ScDPAggData() { delete pChild; }
 
-    void    Update( const ScDPValueData& rNext, ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState );
+    void    Update( const ScDPValue& rNext, ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState );
     void    Calculate( ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState );
     sal_Bool    IsCalculated() const;
 
@@ -390,7 +390,7 @@ public:
     void                ProcessData( const ::std::vector<SCROW>& aChildMembers,
                                         const ScDPResultDimension* pDataDim,
                                         const ::std::vector<SCROW>& aDataMembers,
-                                        const ::std::vector<ScDPValueData>& aValues );
+                                        const ::std::vector<ScDPValue>& aValues );
     void                FillMemberResults( com::sun::star::uno::Sequence<
                                                 com::sun::star::sheet::MemberResult>* pSequences,
                                             long& rPos, long nMeasure, sal_Bool bRoot,
@@ -439,7 +439,7 @@ private:
     ScDPDataDimension*      pChildDimension;
     ScDPAggData             aAggregate;
 
-    void                UpdateValues( const ::std::vector<ScDPValueData>& aValues, const ScDPSubTotalState& rSubState );
+    void                UpdateValues( const ::std::vector<ScDPValue>& aValues, const ScDPSubTotalState& rSubState );
 
 public:
                         ScDPDataMember( const ScDPResultData* pData, const ScDPResultMember* pRes );
@@ -454,7 +454,7 @@ public:
     sal_Bool              IsNamedItem(   SCROW r ) const;
     sal_Bool                HasHiddenDetails() const;
 
-    void                ProcessData( const ::std::vector< SCROW >& aChildMembers, const ::std::vector<ScDPValueData>& aValues,
+    void                ProcessData( const ::std::vector< SCROW >& aChildMembers, const ::std::vector<ScDPValue>& aValues,
                                        const ScDPSubTotalState& rSubState );
     sal_Bool                HasError( long nMeasure, const ScDPSubTotalState& rSubState ) const;
     double              GetAggregate( long nMeasure, const ScDPSubTotalState& rSubState ) const;
@@ -540,7 +540,7 @@ public:
     void                ProcessData( const ::std::vector<SCROW>& aMembers,
                                      const ScDPResultDimension* pDataDim,
                                      const ::std::vector<SCROW>& aDataMembers,
-                                     const ::std::vector<ScDPValueData>& aValues ) const;   //! Test
+                                     const ::std::vector<ScDPValue>& aValues ) const;   //! Test
     void                FillMemberResults( com::sun::star::uno::Sequence<
                                                 com::sun::star::sheet::MemberResult>* pSequences,
                                             long nStart, long nMeasure );
@@ -610,7 +610,7 @@ public:
                         ~ScDPDataDimension();
 
     void                InitFrom( const ScDPResultDimension* pDim );        // recursive
-    void                ProcessData( const ::std::vector< SCROW >& aDataMembers, const ::std::vector<ScDPValueData>& aValues,
+    void                ProcessData( const ::std::vector< SCROW >& aDataMembers, const ::std::vector<ScDPValue>& aValues,
                                        const ScDPSubTotalState& rSubState );
     void                FillDataRow( const ScDPResultDimension* pRefDim,
                                     com::sun::star::uno::Sequence<com::sun::star::sheet::DataResult>& rSequence,
diff --git a/sc/source/core/data/dpfilteredcache.cxx b/sc/source/core/data/dpfilteredcache.cxx
index acb253d..e361753 100644
--- a/sc/source/core/data/dpfilteredcache.cxx
+++ b/sc/source/core/data/dpfilteredcache.cxx
@@ -278,7 +278,7 @@ const ScDPItemData* ScDPFilteredCache::getCell(SCCOL nCol, SCROW nRow, bool bRep
    return mrCache.GetItemDataById( nCol, nId );
 }
 
-void  ScDPFilteredCache::getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const
+void  ScDPFilteredCache::getValue( ScDPValue& rVal, SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const
 {
     const ScDPItemData* pData = getCell( nCol, nRow, bRepeatIfEmpty );
 
@@ -288,7 +288,7 @@ void  ScDPFilteredCache::getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow,
         rVal.meType = pData->GetCellType();
     }
     else
-        rVal.Set(0.0, ScDPValueData::Empty);
+        rVal.Set(0.0, ScDPValue::Empty);
 }
 
 rtl::OUString ScDPFilteredCache::getFieldName(SCCOL nIndex) const
diff --git a/sc/source/core/data/dpglobal.cxx b/sc/source/core/data/dpglobal.cxx
index 3e690b2..15571d3 100644
--- a/sc/source/core/data/dpglobal.cxx
+++ b/sc/source/core/data/dpglobal.cxx
@@ -9,9 +9,9 @@
 
 #include "dpglobal.hxx"
 
-ScDPValueData::ScDPValueData() : mfValue(0.0), meType(String) {}
+ScDPValue::ScDPValue() : mfValue(0.0), meType(String) {}
 
-void ScDPValueData::Set( double fV, Type eT )
+void ScDPValue::Set( double fV, Type eT )
 {
     mfValue = fV;
     meType = eT;
diff --git a/sc/source/core/data/dpitemdata.cxx b/sc/source/core/data/dpitemdata.cxx
index 9cac3e1..1e0bb3c 100644
--- a/sc/source/core/data/dpitemdata.cxx
+++ b/sc/source/core/data/dpitemdata.cxx
@@ -267,21 +267,21 @@ ScDPItemData& ScDPItemData::operator= (const ScDPItemData& r)
     return *this;
 }
 
-ScDPValueData::Type ScDPItemData::GetCellType() const
+ScDPValue::Type ScDPItemData::GetCellType() const
 {
     switch (meType)
     {
         case Error:
-            return ScDPValueData::Error;
+            return ScDPValue::Error;
         case Empty:
-            return ScDPValueData::Empty;
+            return ScDPValue::Empty;
         case Value:
-            return ScDPValueData::Value;
+            return ScDPValue::Value;
         default:
             ;
     }
 
-    return ScDPValueData::String;
+    return ScDPValue::String;
 }
 
 #if DEBUG_PIVOT_TABLE
diff --git a/sc/source/core/data/dptabdat.cxx b/sc/source/core/data/dptabdat.cxx
index e7b9826..fbb32d4 100644
--- a/sc/source/core/data/dptabdat.cxx
+++ b/sc/source/core/data/dptabdat.cxx
@@ -165,12 +165,12 @@ void ScDPTableData::FillRowDataFromCacheTable(sal_Int32 nRow, const ScDPFiltered
     for (sal_Int32 i = 0; i < n; ++i)
     {
         long nDim = rInfo.aDataSrcCols[i];
-        rData.aValues.push_back( ScDPValueData() );
+        rData.aValues.push_back( ScDPValue() );
         // #i111435# GetItemData needs dimension indexes including groups,
         // so the index must be checked here (groups aren't useful as data fields).
         if ( nDim < nCacheColumnCount )
         {
-            ScDPValueData& rVal = rData.aValues.back();
+            ScDPValue& rVal = rData.aValues.back();
             rCacheTable.getValue( rVal, static_cast<SCCOL>(nDim), static_cast<SCROW>(nRow), false);
         }
     }
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 974e943..a2b21e9 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -362,12 +362,12 @@ ScDPRelativePos::ScDPRelativePos( long nBase, long nDir ) :
 
 // -----------------------------------------------------------------------
 
-void ScDPAggData::Update( const ScDPValueData& rNext, ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState )
+void ScDPAggData::Update( const ScDPValue& rNext, ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState )
 {
     if (nCount<0)       // error?
         return;         // nothing more...
 
-    if (rNext.meType == ScDPValueData::Empty)
+    if (rNext.meType == ScDPValue::Empty)
         return;
 
     if ( rSubState.eColForce != SUBTOTAL_FUNC_NONE && rSubState.eRowForce != SUBTOTAL_FUNC_NONE &&
@@ -381,12 +381,12 @@ void ScDPAggData::Update( const ScDPValueData& rNext, ScSubTotalFunc eFunc, cons
 
     if ( eFunc != SUBTOTAL_FUNC_CNT2 )          // CNT2 counts everything, incl. strings and errors
     {
-        if (rNext.meType == ScDPValueData::Error)
+        if (rNext.meType == ScDPValue::Error)
         {
             nCount = -1;        // -1 for error (not for CNT2)
             return;
         }
-        if (rNext.meType == ScDPValueData::String)
+        if (rNext.meType == ScDPValue::String)
             return;             // ignore
     }
 
@@ -1239,7 +1239,7 @@ long ScDPResultMember::GetSubTotalCount( long* pUserSubStart ) const
 }
 
 void ScDPResultMember::ProcessData( const vector< SCROW >& aChildMembers, const ScDPResultDimension* pDataDim,
-                                    const vector< SCROW >& aDataMembers, const vector<ScDPValueData>& aValues )
+                                    const vector< SCROW >& aDataMembers, const vector<ScDPValue>& aValues )
 {
     SetHasElements();
 
@@ -1843,7 +1843,7 @@ static long lcl_GetSubTotalPos( const ScDPSubTotalState& rSubState )
     return nRet;
 }
 
-void ScDPDataMember::UpdateValues( const vector<ScDPValueData>& aValues, const ScDPSubTotalState& rSubState )
+void ScDPDataMember::UpdateValues( const vector<ScDPValue>& aValues, const ScDPSubTotalState& rSubState )
 {
     //! find out how many and which subtotals are used
 
@@ -1867,7 +1867,7 @@ void ScDPDataMember::UpdateValues( const vector<ScDPValueData>& aValues, const S
     }
 }
 
-void ScDPDataMember::ProcessData( const vector< SCROW >& aChildMembers, const vector<ScDPValueData>& aValues,
+void ScDPDataMember::ProcessData( const vector< SCROW >& aChildMembers, const vector<ScDPValue>& aValues,
                                     const ScDPSubTotalState& rSubState )
 {
     if ( pResultData->IsLateInit() && !pChildDimension && pResultMember && pResultMember->GetChildDimension() )
@@ -2951,7 +2951,7 @@ bool ScDPResultDimension::IsValidEntry( const vector< SCROW >& aMembers ) const
 void ScDPResultDimension::ProcessData( const vector< SCROW >& aMembers,
                                        const ScDPResultDimension* pDataDim,
                                        const vector< SCROW >& aDataMembers,
-                                       const vector<ScDPValueData>& aValues ) const
+                                       const vector<ScDPValue>& aValues ) const
 {
     if (aMembers.empty())
         return;
@@ -3498,7 +3498,7 @@ void ScDPDataDimension::InitFrom( const ScDPResultDimension* pDim )
     }
 }
 
-void ScDPDataDimension::ProcessData( const vector< SCROW >& aDataMembers, const vector<ScDPValueData>& aValues,
+void ScDPDataDimension::ProcessData( const vector< SCROW >& aDataMembers, const vector<ScDPValue>& aValues,
                                      const ScDPSubTotalState& rSubState )
 {
     // the ScDPItemData array must contain enough entries for all dimensions - this isn't checked
commit 0d22c49de2633ba540c00038633c60af172cc516
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Feb 13 17:36:17 2013 -0500

    Switch integer constants to enum & prefix data members with 'm'.
    
    Change-Id: I13374e160bb369f64fc6e661c43db5da657cbfd9

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index d205b4a..b72deec 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -122,6 +122,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 	sc/source/core/data/document \
 	sc/source/core/data/dpdimsave \
 	sc/source/core/data/dpfilteredcache \
+	sc/source/core/data/dpglobal \
 	sc/source/core/data/dpgroup \
 	sc/source/core/data/dpitemdata \
 	sc/source/core/data/dpnumgroupinfo \
diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx
index fe94b32..6fffc64 100644
--- a/sc/inc/dpglobal.hxx
+++ b/sc/inc/dpglobal.hxx
@@ -35,6 +35,18 @@
 #define     PIVOT_FUNC_STD_VARP     0x0400
 #define     PIVOT_FUNC_AUTO         0x1000
 
+struct ScDPValueData
+{
+    enum Type { Empty = 0, Value, String, Error };
+
+    double mfValue;
+    Type meType;
+
+    ScDPValueData();
+
+    void Set( double fV, Type eT );
+};
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/dpitemdata.hxx b/sc/inc/dpitemdata.hxx
index f44bc3a..bd33607 100644
--- a/sc/inc/dpitemdata.hxx
+++ b/sc/inc/dpitemdata.hxx
@@ -36,6 +36,7 @@
 #include "tools/solar.h"
 #include "rtl/ustring.hxx"
 #include "dpmacros.hxx"
+#include "dpglobal.hxx"
 
 /**
  * When assigning a string value, you can also assign an interned string
@@ -109,7 +110,7 @@ public:
     GroupValueAttr GetGroupValue() const;
     bool HasStringData() const ;
 
-    sal_uInt8 GetCellType() const;
+    ScDPValueData::Type GetCellType() const;
 
 #if DEBUG_PIVOT_TABLE
     void Dump(const char* msg) const;
diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx
index 6742f58..7c6dd33 100644
--- a/sc/inc/dptabdat.hxx
+++ b/sc/inc/dptabdat.hxx
@@ -54,24 +54,6 @@ namespace com { namespace sun { namespace star { namespace sheet {
 #define SC_DAPI_LEVEL_WEEK      4
 #define SC_DAPI_LEVEL_WEEKDAY   5
 
-
-//
-//  base class ScDPTableData to allow implementation with tabular data
-//  by deriving only of this
-//
-#define SC_VALTYPE_EMPTY    0
-#define SC_VALTYPE_VALUE    1
-#define SC_VALTYPE_STRING   2
-#define SC_VALTYPE_ERROR    3
-
-struct ScDPValueData
-{
-    double  fValue;
-    sal_uInt8   nType;
-
-    void    Set( double fV, sal_uInt8 nT ) { fValue = fV; nType = nT; }
-};
-
 class ScDPResultMember;
 class ScDPDimension;
 class ScDPLevel;
diff --git a/sc/source/core/data/dpfilteredcache.cxx b/sc/source/core/data/dpfilteredcache.cxx
index e3231ce..acb253d 100644
--- a/sc/source/core/data/dpfilteredcache.cxx
+++ b/sc/source/core/data/dpfilteredcache.cxx
@@ -284,11 +284,11 @@ void  ScDPFilteredCache::getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow,
 
     if (pData)
     {
-        rVal.fValue = pData->IsValue() ? pData->GetValue() : 0.0;
-        rVal.nType = pData->GetCellType();
+        rVal.mfValue = pData->IsValue() ? pData->GetValue() : 0.0;
+        rVal.meType = pData->GetCellType();
     }
     else
-        rVal.Set(0.0, SC_VALTYPE_EMPTY);
+        rVal.Set(0.0, ScDPValueData::Empty);
 }
 
 rtl::OUString ScDPFilteredCache::getFieldName(SCCOL nIndex) const
diff --git a/sc/source/core/data/dpglobal.cxx b/sc/source/core/data/dpglobal.cxx
new file mode 100644
index 0000000..3e690b2
--- /dev/null
+++ b/sc/source/core/data/dpglobal.cxx
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "dpglobal.hxx"
+
+ScDPValueData::ScDPValueData() : mfValue(0.0), meType(String) {}
+
+void ScDPValueData::Set( double fV, Type eT )
+{
+    mfValue = fV;
+    meType = eT;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/dpitemdata.cxx b/sc/source/core/data/dpitemdata.cxx
index 85a6917..9cac3e1 100644
--- a/sc/source/core/data/dpitemdata.cxx
+++ b/sc/source/core/data/dpitemdata.cxx
@@ -267,21 +267,21 @@ ScDPItemData& ScDPItemData::operator= (const ScDPItemData& r)
     return *this;
 }
 
-sal_uInt8 ScDPItemData::GetCellType() const
+ScDPValueData::Type ScDPItemData::GetCellType() const
 {
     switch (meType)
     {
         case Error:
-            return SC_VALTYPE_ERROR;
+            return ScDPValueData::Error;
         case Empty:
-            return SC_VALTYPE_EMPTY;
+            return ScDPValueData::Empty;
         case Value:
-            return SC_VALTYPE_VALUE;
+            return ScDPValueData::Value;
         default:
             ;
     }
 
-    return SC_VALTYPE_STRING;
+    return ScDPValueData::String;
 }
 
 #if DEBUG_PIVOT_TABLE
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index e5e3e92..974e943 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -367,7 +367,7 @@ void ScDPAggData::Update( const ScDPValueData& rNext, ScSubTotalFunc eFunc, cons
     if (nCount<0)       // error?
         return;         // nothing more...
 
-    if ( rNext.nType == SC_VALTYPE_EMPTY )
+    if (rNext.meType == ScDPValueData::Empty)
         return;
 
     if ( rSubState.eColForce != SUBTOTAL_FUNC_NONE && rSubState.eRowForce != SUBTOTAL_FUNC_NONE &&
@@ -381,12 +381,12 @@ void ScDPAggData::Update( const ScDPValueData& rNext, ScSubTotalFunc eFunc, cons
 
     if ( eFunc != SUBTOTAL_FUNC_CNT2 )          // CNT2 counts everything, incl. strings and errors
     {
-        if ( rNext.nType == SC_VALTYPE_ERROR )
+        if (rNext.meType == ScDPValueData::Error)
         {
             nCount = -1;        // -1 for error (not for CNT2)
             return;
         }
-        if ( rNext.nType == SC_VALTYPE_STRING )
+        if (rNext.meType == ScDPValueData::String)
             return;             // ignore
     }
 
@@ -396,13 +396,13 @@ void ScDPAggData::Update( const ScDPValueData& rNext, ScSubTotalFunc eFunc, cons
     {
         case SUBTOTAL_FUNC_SUM:
         case SUBTOTAL_FUNC_AVE:
-            if ( !SubTotal::SafePlus( fVal, rNext.fValue ) )
+            if ( !SubTotal::SafePlus( fVal, rNext.mfValue ) )
                 nCount = -1;                            // -1 for error
             break;
         case SUBTOTAL_FUNC_PROD:
             if ( nCount == 1 )          // copy first value (fVal is initialized to 0)
-                fVal = rNext.fValue;
-            else if ( !SubTotal::SafeMult( fVal, rNext.fValue ) )
+                fVal = rNext.mfValue;
+            else if ( !SubTotal::SafeMult( fVal, rNext.mfValue ) )
                 nCount = -1;                            // -1 for error
             break;
         case SUBTOTAL_FUNC_CNT:
@@ -410,12 +410,12 @@ void ScDPAggData::Update( const ScDPValueData& rNext, ScSubTotalFunc eFunc, cons
             //  nothing more than incrementing nCount
             break;
         case SUBTOTAL_FUNC_MAX:
-            if ( nCount == 1 || rNext.fValue > fVal )
-                fVal = rNext.fValue;
+            if ( nCount == 1 || rNext.mfValue > fVal )
+                fVal = rNext.mfValue;
             break;
         case SUBTOTAL_FUNC_MIN:
-            if ( nCount == 1 || rNext.fValue < fVal )
-                fVal = rNext.fValue;
+            if ( nCount == 1 || rNext.mfValue < fVal )
+                fVal = rNext.mfValue;
             break;
         case SUBTOTAL_FUNC_STD:
         case SUBTOTAL_FUNC_STDP:
@@ -423,10 +423,10 @@ void ScDPAggData::Update( const ScDPValueData& rNext, ScSubTotalFunc eFunc, cons
         case SUBTOTAL_FUNC_VARP:
             {
                 // fAux is used to sum up squares
-                if ( !SubTotal::SafePlus( fVal, rNext.fValue ) )
+                if ( !SubTotal::SafePlus( fVal, rNext.mfValue ) )
                     nCount = -1;                            // -1 for error
-                double fAdd = rNext.fValue;
-                if ( !SubTotal::SafeMult( fAdd, rNext.fValue ) ||
+                double fAdd = rNext.mfValue;
+                if ( !SubTotal::SafeMult( fAdd, rNext.mfValue ) ||
                      !SubTotal::SafePlus( fAux, fAdd ) )
                     nCount = -1;                            // -1 for error
             }


More information about the Libreoffice-commits mailing list