diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-15 09:36:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-15 21:36:50 +0200 |
commit | 24ceb100883e5413b1e911bf1bc29df008972a5a (patch) | |
tree | 0e4f93ba2036e459ae70bd430a9902d98687aa89 | |
parent | bf3d1b8e8f89bfdb409c70cfea126f36474d4772 (diff) |
CreateNameSortedArray never passed a null ScDocument*
Change-Id: Ib5501d3b3eef77224ffb091df0e30ecab9859c8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102777
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/inc/rangelst.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/rangelst.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/crnrdlg.cxx | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx index 48a2b088065e..3ceb582baa6d 100644 --- a/sc/inc/rangelst.hxx +++ b/sc/inc/rangelst.hxx @@ -144,7 +144,7 @@ public: ScRangePair* Find( const ScAddress& ); ScRangePair* Find( const ScRange& ); std::vector<const ScRangePair*> - CreateNameSortedArray( ScDocument* ) const; + CreateNameSortedArray( ScDocument& ) const; void Remove(size_t nPos); void Remove(const ScRangePair & rAdr); diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 12d4e64678f4..c49e9694c0c8 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -1318,7 +1318,7 @@ namespace { class ScRangePairList_sortNameCompare { public: - ScRangePairList_sortNameCompare(ScDocument *pDoc) : mpDoc(pDoc) {} + ScRangePairList_sortNameCompare(ScDocument& rDoc) : mrDoc(rDoc) {} bool operator()( const ScRangePair *ps1, const ScRangePair* ps2 ) const { @@ -1330,8 +1330,8 @@ public: nComp = 0; else { - mpDoc->GetName( rStartPos1.Tab(), aStr1 ); - mpDoc->GetName( rStartPos2.Tab(), aStr2 ); + mrDoc.GetName( rStartPos1.Tab(), aStr1 ); + mrDoc.GetName( rStartPos2.Tab(), aStr2 ); nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 ); } if (nComp < 0) @@ -1361,8 +1361,8 @@ public: nComp = 0; else { - mpDoc->GetName( rEndPos1.Tab(), aStr1 ); - mpDoc->GetName( rEndPos2.Tab(), aStr2 ); + mrDoc.GetName( rEndPos1.Tab(), aStr1 ); + mrDoc.GetName( rEndPos2.Tab(), aStr2 ); nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 ); } if (nComp < 0) @@ -1388,7 +1388,7 @@ public: return false; } private: - ScDocument *mpDoc; + ScDocument& mrDoc; }; } @@ -1522,7 +1522,7 @@ Label_RangePair_Join: Append( r ); } -std::vector<const ScRangePair*> ScRangePairList::CreateNameSortedArray( ScDocument* pDoc ) const +std::vector<const ScRangePair*> ScRangePairList::CreateNameSortedArray( ScDocument& rDoc ) const { std::vector<const ScRangePair*> aSortedVec(maPairs.size()); size_t i = 0; @@ -1531,7 +1531,7 @@ std::vector<const ScRangePair*> ScRangePairList::CreateNameSortedArray( ScDocume aSortedVec[i++] = &rPair; } - std::sort( aSortedVec.begin(), aSortedVec.end(), ScRangePairList_sortNameCompare(pDoc) ); + std::sort( aSortedVec.begin(), aSortedVec.end(), ScRangePairList_sortNameCompare(rDoc) ); return aSortedVec; } diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 31dd29e9b879..a82d8d26762f 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -369,7 +369,7 @@ void ScColRowNameRangesDlg::UpdateNames() if ( xColNameRanges->size() > 0 ) { std::vector<const ScRangePair*> aSortArray(xColNameRanges->CreateNameSortedArray( - &rDoc )); + rDoc )); nCount = aSortArray.size(); for ( j=0; j < nCount; j++ ) { @@ -408,7 +408,7 @@ void ScColRowNameRangesDlg::UpdateNames() if ( xRowNameRanges->size() > 0 ) { std::vector<const ScRangePair*> aSortArray(xRowNameRanges->CreateNameSortedArray( - &rDoc )); + rDoc )); nCount = aSortArray.size(); for ( j=0; j < nCount; j++ ) { |