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

Kohei Yoshida kohei.yoshida at gmail.com
Thu Feb 14 17:58:29 PST 2013


 sc/inc/dptabres.hxx              |   43 +++++++-------
 sc/source/core/data/dptabres.cxx |  114 +++++++++++++++------------------------
 sc/source/core/data/dptabsrc.cxx |   13 ----
 3 files changed, 68 insertions(+), 102 deletions(-)

New commits:
commit fe9e3c51f9b7232fd61de8f7d6633146c095d545
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Feb 14 20:55:29 2013 -0500

    Why in the world would anyone pass an integer as a const reference...
    
    Change-Id: Ibd205e972c3c16ef68db2909496704c05161c4e8

diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index 68d53f7..8ebdc8a 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -246,7 +246,7 @@ class ResultMembers
     DimMemberHash      maMemberHash;
     bool mbHasHideDetailsMember;
 public:
-    ScDPParentDimData* FindMember( const SCROW& nIndex ) const;
+    ScDPParentDimData* FindMember( SCROW nIndex ) const;
     void                             InsertMember(  ScDPParentDimData* pNew );
     bool IsHasHideDetailsMembers() const { return mbHasHideDetailsMember; }
     void SetHasHideDetailsMembers( bool b ) { mbHasHideDetailsMember = b; }
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index e6f7356..58d0c2e 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -3916,7 +3916,7 @@ ScDPParentDimData::ScDPParentDimData(
     SCROW nIndex, const ScDPDimension* pDim, const ScDPLevel* pLev, const ScDPMember* pMember) :
     mnOrder(nIndex), mpParentDim(pDim), mpParentLevel(pLev), mpMemberDesc(pMember) {}
 
-ScDPParentDimData* ResultMembers::FindMember( const SCROW& nIndex ) const
+ScDPParentDimData* ResultMembers::FindMember( SCROW nIndex ) const
 {
     DimMemberHash::const_iterator aRes = maMemberHash.find( nIndex );
     if( aRes != maMemberHash.end()) {
commit 29267e940a5280e959ae50828839beeb9314a8da
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Feb 14 20:53:18 2013 -0500

    This should be a struct & let's not put everything in header.
    
    Change-Id: Ic9b56092d5dcc3f2dc48d8f0909cb1e3f967c3d5

diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index bd628d0..68d53f7 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -227,16 +227,15 @@ struct MemberHashIndexFunc : public std::unary_function< const SCROW &, size_t >
     size_t operator() (const SCROW &rDataIndex) const { return rDataIndex; }
 };
 
-class ScDPParentDimData
+struct ScDPParentDimData
 {
-public:
-    const SCROW                     mnOrder;                        //! Ref
+    const SCROW                     mnOrder;                //! Ref
     const ScDPDimension*            mpParentDim;            //! Ref
     const ScDPLevel*                mpParentLevel;          //! Ref
     const ScDPMember*               mpMemberDesc;           //! Ref
 
-    ScDPParentDimData():mnOrder(-1), mpParentDim( NULL), mpParentLevel( NULL ), mpMemberDesc( NULL ){}
-    ScDPParentDimData( const SCROW nIndex, ScDPDimension* pDim, const ScDPLevel* pLev, const ScDPMember* pMember ): mnOrder( nIndex ), mpParentDim( pDim), mpParentLevel( pLev ), mpMemberDesc( pMember ){}
+    ScDPParentDimData();
+    ScDPParentDimData(SCROW nIndex, const ScDPDimension* pDim, const ScDPLevel* pLev, const ScDPMember* pMember);
 };
 
 typedef std::vector <ScDPParentDimData *>                 DimMemberArray;
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 8fa53a4..e6f7356 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -3909,6 +3909,13 @@ void ScDPResultDimension::InitWithMembers(
     }
 }
 
+ScDPParentDimData::ScDPParentDimData() :
+    mnOrder(-1), mpParentDim(NULL), mpParentLevel(NULL), mpMemberDesc(NULL) {}
+
+ScDPParentDimData::ScDPParentDimData(
+    SCROW nIndex, const ScDPDimension* pDim, const ScDPLevel* pLev, const ScDPMember* pMember) :
+    mnOrder(nIndex), mpParentDim(pDim), mpParentLevel(pLev), mpMemberDesc(pMember) {}
+
 ScDPParentDimData* ResultMembers::FindMember( const SCROW& nIndex ) const
 {
     DimMemberHash::const_iterator aRes = maMemberHash.find( nIndex );
commit 4931d3e5cfc83827faa26377ee77b9839ab93b9c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Feb 14 20:44:23 2013 -0500

    Actually we can just swap them. The originals are not used after this call.
    
    This avoids redundant copying of vectors.
    
    Change-Id: I1da8295774a1a39fd4df021fee1a3036134067a8

diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index 989e8d3..bd628d0 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -292,7 +292,7 @@ class ScDPResultData
     std::vector<ScSubTotalFunc> maMeasureFuncs;
     std::vector<com::sun::star::sheet::DataPilotFieldReference> maMeasureRefs;
     std::vector<sal_uInt16> maMeasureRefOrients;
-    std::vector<rtl::OUString> maMeasureNames;
+    std::vector<OUString> maMeasureNames;
 
     bool                    bLateInit:1;
     bool                    bDataAtCol:1;
@@ -304,9 +304,11 @@ public:
     ScDPResultData( ScDPSource& rSrc );
     ~ScDPResultData();
 
-    void                SetMeasureData( long nCount, const ScSubTotalFunc* pFunctions,
-                                        const ::com::sun::star::sheet::DataPilotFieldReference* pRefs,
-                                        const sal_uInt16* pRefOrient, std::vector<rtl::OUString>& rNames );
+    void SetMeasureData(
+        std::vector<ScSubTotalFunc>& rFunctions,
+        std::vector<com::sun::star::sheet::DataPilotFieldReference>& rRefs,
+        std::vector<sal_uInt16>& rRefOrient, std::vector<OUString>& rNames );
+
     void                SetDataLayoutOrientation( sal_uInt16 nOrient );
     void                SetLateInit( bool bSet );
 
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 3499300..8fa53a4 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -724,33 +724,14 @@ ScDPResultData::~ScDPResultData()
     std::for_each(maDimMembers.begin(), maDimMembers.end(), ScDeleteObjectByPtr<ResultMembers>());
 }
 
-void ScDPResultData::SetMeasureData( long nCount, const ScSubTotalFunc* pFunctions,
-                                    const sheet::DataPilotFieldReference* pRefs, const sal_uInt16* pRefOrient,
-                                    std::vector<rtl::OUString>& rNames )
-{
-    maMeasureFuncs.clear();
-    maMeasureRefs.clear();
-    maMeasureRefOrients.clear();
-
-    if ( nCount )
-    {
-        OSL_ASSERT(nCount == static_cast<long>(rNames.size()));
-        maMeasureFuncs.assign(pFunctions, pFunctions+nCount);
-        maMeasureRefs.assign(pRefs, pRefs+nCount);
-        maMeasureRefOrients.assign(pRefOrient, pRefOrient+nCount);
-        maMeasureNames.swap(rNames);
-    }
-    else
-    {
-        //  use one dummy measure
-        maMeasureFuncs.push_back(SUBTOTAL_FUNC_NONE);
-        maMeasureRefs.push_back(sheet::DataPilotFieldReference()); // default ctor is ok
-        maMeasureRefOrients.push_back(sheet::DataPilotFieldOrientation_HIDDEN);
-
-        std::vector<rtl::OUString> aMeasureName;
-        aMeasureName.push_back(ScGlobal::GetRscString(STR_EMPTYDATA));
-        maMeasureNames.swap(aMeasureName);
-    }
+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);
 }
 
 void ScDPResultData::SetDataLayoutOrientation( sal_uInt16 nOrient )
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index 2d7b6e3..7fdf75c 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -841,16 +841,7 @@ void ScDPSource::CreateRes_Impl()
     }
 
     pResData = new ScDPResultData(*this);
-    const ScSubTotalFunc* pDataFunctions = NULL;
-    const sheet::DataPilotFieldReference* pDataRefValues = NULL;
-    const sal_uInt16* pDataRefOrient = NULL;
-    if (!maDataDims.empty())
-    {
-        pDataFunctions = &aDataFunctions[0];
-        pDataRefValues = &aDataRefValues[0];
-        pDataRefOrient = &aDataRefOrient[0];
-    }
-    pResData->SetMeasureData(maDataDims.size(), pDataFunctions, pDataRefValues, pDataRefOrient, aDataNames);
+    pResData->SetMeasureData(aDataFunctions, aDataRefValues, aDataRefOrient, aDataNames);
     pResData->SetDataLayoutOrientation(nDataOrient);
     pResData->SetLateInit( bLateInit );
 
commit c669d9e645b7600cf8ed0cc696e99f4552b167a4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Feb 14 20:22:53 2013 -0500

    Use std::vector instead of C-style arrays.
    
    Change-Id: I593c6c50aeb4ead723076d01e7113de154e2557d

diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index dda33f6..989e8d3 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -289,11 +289,11 @@ class ScDPResultData
     ScDPSource& mrSource;
     //! keep things like measure lists here
 
-    long                    nMeasCount;
-    ScSubTotalFunc*         pMeasFuncs;
-    ::com::sun::star::sheet::DataPilotFieldReference* pMeasRefs;
-    sal_uInt16*                 pMeasRefOrient;
+    std::vector<ScSubTotalFunc> maMeasureFuncs;
+    std::vector<com::sun::star::sheet::DataPilotFieldReference> maMeasureRefs;
+    std::vector<sal_uInt16> maMeasureRefOrients;
     std::vector<rtl::OUString> maMeasureNames;
+
     bool                    bLateInit:1;
     bool                    bDataAtCol:1;
     bool                    bDataAtRow:1;
@@ -310,7 +310,7 @@ public:
     void                SetDataLayoutOrientation( sal_uInt16 nOrient );
     void                SetLateInit( bool bSet );
 
-    long                GetMeasureCount() const     { return nMeasCount; }
+    long GetMeasureCount() const { return maMeasureFuncs.size(); }
     ScSubTotalFunc      GetMeasureFunction(long nMeasure) const;
     rtl::OUString       GetMeasureString(long nMeasure, bool bForce, ScSubTotalFunc eForceFunc, bool& rbTotalResult) const;
     rtl::OUString       GetMeasureDimensionName(long nMeasure) const;
@@ -324,8 +324,7 @@ public:
     long                GetColStartMeasure() const;
     long                GetRowStartMeasure() const;
 
-    long                GetCountForMeasure( long nMeas ) const
-                                { return ( nMeas == SC_DPMEASURE_ALL ) ? nMeasCount : 1; }
+    long GetCountForMeasure( long nMeas ) const { return (nMeas == SC_DPMEASURE_ALL) ? maMeasureFuncs.size() : 1; }
 
     bool                IsBaseForGroup( long nDim ) const;              // any group
     long                GetGroupBase( long nGroupDim ) const;
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index bcb4dfe..3499300 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -713,10 +713,6 @@ static ScSubTotalFunc lcl_GetForceFunc( const ScDPLevel* pLevel, long nFuncNo )
 
 ScDPResultData::ScDPResultData( ScDPSource& rSrc ) :
     mrSource(rSrc),
-    nMeasCount( 0 ),
-    pMeasFuncs( NULL ),
-    pMeasRefs( NULL ),
-    pMeasRefOrient( NULL ),
     bLateInit( false ),
     bDataAtCol( false ),
     bDataAtRow( false )
@@ -725,10 +721,6 @@ ScDPResultData::ScDPResultData( ScDPSource& rSrc ) :
 
 ScDPResultData::~ScDPResultData()
 {
-    delete[] pMeasFuncs;
-    delete[] pMeasRefs;
-    delete[] pMeasRefOrient;
-
     std::for_each(maDimMembers.begin(), maDimMembers.end(), ScDeleteObjectByPtr<ResultMembers>());
 }
 
@@ -736,33 +728,25 @@ void ScDPResultData::SetMeasureData( long nCount, const ScSubTotalFunc* pFunctio
                                     const sheet::DataPilotFieldReference* pRefs, const sal_uInt16* pRefOrient,
                                     std::vector<rtl::OUString>& rNames )
 {
-    delete[] pMeasFuncs;
-    delete[] pMeasRefs;
-    delete[] pMeasRefOrient;
+    maMeasureFuncs.clear();
+    maMeasureRefs.clear();
+    maMeasureRefOrients.clear();
+
     if ( nCount )
     {
         OSL_ASSERT(nCount == static_cast<long>(rNames.size()));
-        nMeasCount = nCount;
-        pMeasFuncs = new ScSubTotalFunc[nCount];
-        pMeasRefs  = new sheet::DataPilotFieldReference[nCount];
-        pMeasRefOrient = new sal_uInt16[nCount];
+        maMeasureFuncs.assign(pFunctions, pFunctions+nCount);
+        maMeasureRefs.assign(pRefs, pRefs+nCount);
+        maMeasureRefOrients.assign(pRefOrient, pRefOrient+nCount);
         maMeasureNames.swap(rNames);
-        for (long i=0; i<nCount; i++)
-        {
-            pMeasFuncs[i] = pFunctions[i];
-            pMeasRefs[i]  = pRefs[i];
-            pMeasRefOrient[i] = pRefOrient[i];
-        }
     }
     else
     {
         //  use one dummy measure
-        nMeasCount = 1;
-        pMeasFuncs = new ScSubTotalFunc[1];
-        pMeasFuncs[0] = SUBTOTAL_FUNC_NONE;
-        pMeasRefs  = new sheet::DataPilotFieldReference[1]; // default ctor is ok
-        pMeasRefOrient = new sal_uInt16[1];
-        pMeasRefOrient[0] = sheet::DataPilotFieldOrientation_HIDDEN;
+        maMeasureFuncs.push_back(SUBTOTAL_FUNC_NONE);
+        maMeasureRefs.push_back(sheet::DataPilotFieldReference()); // default ctor is ok
+        maMeasureRefOrients.push_back(sheet::DataPilotFieldOrientation_HIDDEN);
+
         std::vector<rtl::OUString> aMeasureName;
         aMeasureName.push_back(ScGlobal::GetRscString(STR_EMPTYDATA));
         maMeasureNames.swap(aMeasureName);
@@ -782,32 +766,36 @@ void ScDPResultData::SetLateInit( bool bSet )
 
 long ScDPResultData::GetColStartMeasure() const
 {
-    if ( nMeasCount == 1 ) return 0;
+    if (maMeasureFuncs.size() == 1)
+        return 0;
+
     return bDataAtCol ? SC_DPMEASURE_ALL : SC_DPMEASURE_ANY;
 }
 
 long ScDPResultData::GetRowStartMeasure() const
 {
-    if ( nMeasCount == 1 ) return 0;
+    if (maMeasureFuncs.size() == 1)
+        return 0;
+
     return bDataAtRow ? SC_DPMEASURE_ALL : SC_DPMEASURE_ANY;
 }
 
 ScSubTotalFunc ScDPResultData::GetMeasureFunction(long nMeasure) const
 {
-    OSL_ENSURE( pMeasFuncs && nMeasure < nMeasCount, "bumm" );
-    return pMeasFuncs[nMeasure];
+    OSL_ENSURE(nMeasure < maMeasureFuncs.size(), "bumm");
+    return maMeasureFuncs[nMeasure];
 }
 
 const sheet::DataPilotFieldReference& ScDPResultData::GetMeasureRefVal(long nMeasure) const
 {
-    OSL_ENSURE( pMeasRefs && nMeasure < nMeasCount, "bumm" );
-    return pMeasRefs[nMeasure];
+    OSL_ENSURE(nMeasure < maMeasureRefs.size(), "bumm");
+    return maMeasureRefs[nMeasure];
 }
 
 sal_uInt16 ScDPResultData::GetMeasureRefOrient(long nMeasure) const
 {
-    OSL_ENSURE( pMeasRefOrient && nMeasure < nMeasCount, "bumm" );
-    return pMeasRefOrient[nMeasure];
+    OSL_ENSURE(nMeasure < maMeasureRefOrients.size(), "bumm");
+    return maMeasureRefOrients[nMeasure];
 }
 
 rtl::OUString ScDPResultData::GetMeasureString(long nMeasure, bool bForce, ScSubTotalFunc eForceFunc, bool& rbTotalResult) const
@@ -815,7 +803,7 @@ rtl::OUString ScDPResultData::GetMeasureString(long nMeasure, bool bForce, ScSub
     //  with bForce==true, return function instead of "result" for single measure
     //  with eForceFunc != SUBTOTAL_FUNC_NONE, always use eForceFunc
     rbTotalResult = false;
-    if ( nMeasure < 0 || ( nMeasCount == 1 && !bForce && eForceFunc == SUBTOTAL_FUNC_NONE ) )
+    if ( nMeasure < 0 || (maMeasureFuncs.size() == 1 && !bForce && eForceFunc == SUBTOTAL_FUNC_NONE) )
     {
         //  for user-specified subtotal function with all measures,
         //  display only function name
@@ -827,7 +815,7 @@ rtl::OUString ScDPResultData::GetMeasureString(long nMeasure, bool bForce, ScSub
     }
     else
     {
-        OSL_ENSURE( nMeasure < nMeasCount, "bumm" );
+        OSL_ENSURE(nMeasure < maMeasureFuncs.size(), "bumm");
         const ScDPDimension* pDataDim = mrSource.GetDataDimension(nMeasure);
         if (pDataDim)
         {
commit edbf1da237b3f276495637b477113618a7b8453b
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Feb 14 19:51:16 2013 -0500

    Pass ScDPSource to ScDPResultData as a reference.
    
    Change-Id: Ia864643c8285de76cb9b026b93b396abd897202d

diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index c9c168f..dda33f6 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -286,8 +286,7 @@ public:
  */
 class ScDPResultData
 {
-private:
-    ScDPSource*             pSource;                //! Ref
+    ScDPSource& mrSource;
     //! keep things like measure lists here
 
     long                    nMeasCount;
@@ -302,8 +301,8 @@ private:
     //! add "displayed values" settings
     mutable std::vector<ResultMembers*> maDimMembers;
 public:
-                        ScDPResultData( ScDPSource* pSrc );     //! Ref
-                        ~ScDPResultData();
+    ScDPResultData( ScDPSource& rSrc );
+    ~ScDPResultData();
 
     void                SetMeasureData( long nCount, const ScSubTotalFunc* pFunctions,
                                         const ::com::sun::star::sheet::DataPilotFieldReference* pRefs,
@@ -338,7 +337,7 @@ public:
 
     ResultMembers* GetDimResultMembers(long nDim, ScDPDimension* pDim, ScDPLevel* pLevel) const;
 
-    const ScDPSource*   GetSource() const;
+    const ScDPSource& GetSource() const;
 };
 
 
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index bae3831..bcb4dfe 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -711,8 +711,8 @@ static ScSubTotalFunc lcl_GetForceFunc( const ScDPLevel* pLevel, long nFuncNo )
 
 // -----------------------------------------------------------------------
 
-ScDPResultData::ScDPResultData( ScDPSource* pSrc ) :        //! Ref
-    pSource( pSrc ),
+ScDPResultData::ScDPResultData( ScDPSource& rSrc ) :
+    mrSource(rSrc),
     nMeasCount( 0 ),
     pMeasFuncs( NULL ),
     pMeasRefs( NULL ),
@@ -828,7 +828,7 @@ rtl::OUString ScDPResultData::GetMeasureString(long nMeasure, bool bForce, ScSub
     else
     {
         OSL_ENSURE( nMeasure < nMeasCount, "bumm" );
-        ScDPDimension* pDataDim = pSource->GetDataDimension(nMeasure);
+        const ScDPDimension* pDataDim = mrSource.GetDataDimension(nMeasure);
         if (pDataDim)
         {
             const OUString* pLayoutName = pDataDim->GetLayoutName();
@@ -858,30 +858,30 @@ rtl::OUString ScDPResultData::GetMeasureDimensionName(long nMeasure) const
         return rtl::OUString::createFromAscii("***");
     }
 
-    return pSource->GetDataDimName( nMeasure );
+    return mrSource.GetDataDimName(nMeasure);
 }
 
 bool ScDPResultData::IsBaseForGroup( long nDim ) const
 {
-    return pSource->GetData()->IsBaseForGroup( nDim );
+    return mrSource.GetData()->IsBaseForGroup(nDim);
 }
 
 long ScDPResultData::GetGroupBase( long nGroupDim ) const
 {
-    return pSource->GetData()->GetGroupBase( nGroupDim );
+    return mrSource.GetData()->GetGroupBase(nGroupDim);
 }
 
 bool ScDPResultData::IsNumOrDateGroup( long nDim ) const
 {
-    return pSource->GetData()->IsNumOrDateGroup( nDim );
+    return mrSource.GetData()->IsNumOrDateGroup(nDim);
 }
 
 bool ScDPResultData::IsInGroup( SCROW nGroupDataId, long nGroupIndex,
                                 const ScDPItemData& rBaseData, long nBaseIndex ) const
 {
-    const ScDPItemData* pGroupData = pSource->GetItemDataById( nGroupIndex , nGroupDataId);
+    const ScDPItemData* pGroupData = mrSource.GetItemDataById(nGroupIndex , nGroupDataId);
     if ( pGroupData )
-        return pSource->GetData()->IsInGroup( *pGroupData, nGroupIndex, rBaseData , nBaseIndex );
+        return mrSource.GetData()->IsInGroup(*pGroupData, nGroupIndex, rBaseData, nBaseIndex);
     else
         return false;
 }
@@ -889,16 +889,16 @@ bool ScDPResultData::IsInGroup( SCROW nGroupDataId, long nGroupIndex,
 bool ScDPResultData::HasCommonElement( SCROW nFirstDataId, long nFirstIndex,
                                        const ScDPItemData& rSecondData, long nSecondIndex ) const
 {
-    const ScDPItemData* pFirstData = pSource->GetItemDataById( nFirstIndex , nFirstDataId);
+    const ScDPItemData* pFirstData = mrSource.GetItemDataById(nFirstIndex , nFirstDataId);
     if ( pFirstData )
-        return pSource->GetData()->HasCommonElement( *pFirstData, nFirstIndex, rSecondData, nSecondIndex );
+        return mrSource.GetData()->HasCommonElement(*pFirstData, nFirstIndex, rSecondData, nSecondIndex);
     else
         return false;
 }
 
-const ScDPSource* ScDPResultData::GetSource() const
+const ScDPSource& ScDPResultData::GetSource() const
 {
-    return pSource;
+    return mrSource;
 }
 
 ResultMembers* ScDPResultData::GetDimResultMembers(long nDim, ScDPDimension* pDim, ScDPLevel* pLevel) const
@@ -1333,7 +1333,7 @@ void ScDPResultMember::FillMemberResults(
         if (aParentDimData.mpParentDim)
         {
             long nDim = aParentDimData.mpParentDim->GetDimension();
-            aName = pResultData->GetSource()->GetData()->GetFormattedString(nDim, aItemData);
+            aName = pResultData->GetSource().GetData()->GetFormattedString(nDim, aItemData);
         }
         else
         {
@@ -1341,7 +1341,7 @@ void ScDPResultMember::FillMemberResults(
             const ScDPMember* pMem = GetDPMember();
             if (pMem)
                 nDim = pMem->GetDim();
-            aName = pResultData->GetSource()->GetData()->GetFormattedString(nDim, aItemData);
+            aName = pResultData->GetSource().GetData()->GetFormattedString(nDim, aItemData);
         }
 
         ScDPItemData::Type eType = aItemData.GetType();
@@ -1456,7 +1456,7 @@ void ScDPResultMember::FillMemberResults(
                     else
                     {
                         // root member - subtotal (grand total?) for multi-data field layout.
-                        const rtl::OUString* pGrandTotalName = pResultData->GetSource()->GetGrandTotalName();
+                        const OUString* pGrandTotalName = pResultData->GetSource().GetGrandTotalName();
                         if (pGrandTotalName)
                             aSubStr = *pGrandTotalName;
                         pArray[rPos].Flags |= sheet::MemberResultFlags::GRANDTOTAL;
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index a079693..2d7b6e3 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -840,7 +840,7 @@ void ScDPSource::CreateRes_Impl()
             aInfo.aDataSrcCols.push_back(nDimIndex);
     }
 
-    pResData = new ScDPResultData( this );
+    pResData = new ScDPResultData(*this);
     const ScSubTotalFunc* pDataFunctions = NULL;
     const sheet::DataPilotFieldReference* pDataRefValues = NULL;
     const sal_uInt16* pDataRefOrient = NULL;


More information about the Libreoffice-commits mailing list