summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-07-03 11:31:14 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-07-06 07:04:50 +0000
commite9c3583c2cc27fc88ee81047c236ec99dd51e8de (patch)
treeb3e8394ca1ec402a31b227339366fc790124c1f8 /sc
parent89c77994d4638c86635c70535fab6508e2f3d900 (diff)
improve the returnbyref loplugin
Change-Id: I1b510a6194282dfa4a9001d473127c5ebc8b44eb Reviewed-on: https://gerrit.libreoffice.org/16731 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/column.hxx2
-rw-r--r--sc/inc/detdata.hxx2
-rw-r--r--sc/inc/dpdimsave.hxx4
-rw-r--r--sc/inc/dpobject.hxx4
-rw-r--r--sc/inc/userlist.hxx4
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx4
-rw-r--r--sc/qa/unit/ucalc_pivottable.cxx3
-rw-r--r--sc/source/core/data/clipcontext.cxx2
-rw-r--r--sc/source/core/data/column.cxx4
-rw-r--r--sc/source/core/data/column3.cxx6
-rw-r--r--sc/source/core/data/documen3.cxx8
-rw-r--r--sc/source/core/data/dpdimsave.cxx8
-rw-r--r--sc/source/core/data/dpobject.cxx8
-rw-r--r--sc/source/core/data/table2.cxx2
-rw-r--r--sc/source/core/data/table3.cxx19
-rw-r--r--sc/source/core/tool/appoptio.cxx2
-rw-r--r--sc/source/core/tool/detdata.cxx4
-rw-r--r--sc/source/core/tool/userlist.cxx8
-rw-r--r--sc/source/filter/excel/excimp8.cxx4
-rw-r--r--sc/source/filter/excel/xechart.cxx4
-rw-r--r--sc/source/filter/excel/xeescher.cxx2
-rw-r--r--sc/source/filter/excel/xeformula.cxx2
-rw-r--r--sc/source/filter/excel/xename.cxx4
-rw-r--r--sc/source/filter/excel/xepivot.cxx38
-rw-r--r--sc/source/filter/excel/xepivotxml.cxx9
-rw-r--r--sc/source/filter/excel/xichart.cxx2
-rw-r--r--sc/source/filter/excel/xicontent.cxx4
-rw-r--r--sc/source/filter/excel/xiname.cxx2
-rw-r--r--sc/source/filter/excel/xipivot.cxx4
-rw-r--r--sc/source/filter/excel/xlroot.cxx4
-rw-r--r--sc/source/filter/inc/xlroot.hxx2
-rw-r--r--sc/source/filter/xcl97/XclImpChangeTrack.cxx4
-rw-r--r--sc/source/filter/xcl97/xcl97esc.cxx10
-rw-r--r--sc/source/filter/xml/XMLExportDataPilot.cxx43
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx19
-rw-r--r--sc/source/ui/app/inputhdl.cxx20
-rw-r--r--sc/source/ui/dbgui/PivotLayoutDialog.cxx4
-rw-r--r--sc/source/ui/dbgui/PivotLayoutTreeList.cxx8
-rw-r--r--sc/source/ui/dbgui/PivotLayoutTreeListData.cxx20
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx2
-rw-r--r--sc/source/ui/dbgui/tpsubt.cxx2
-rw-r--r--sc/source/ui/docshell/docfunc.cxx49
-rw-r--r--sc/source/ui/docshell/docsh.cxx6
-rw-r--r--sc/source/ui/docshell/docsh5.cxx8
-rw-r--r--sc/source/ui/inc/PivotLayoutDialog.hxx2
-rw-r--r--sc/source/ui/inc/areasave.hxx4
-rw-r--r--sc/source/ui/inc/rfindlst.hxx16
-rw-r--r--sc/source/ui/miscdlgs/solveroptions.cxx8
-rw-r--r--sc/source/ui/navipi/content.cxx4
-rw-r--r--sc/source/ui/optdlg/calcoptionsdlg.cxx6
-rw-r--r--sc/source/ui/optdlg/tpusrlst.cxx10
-rw-r--r--sc/source/ui/undo/areasave.cxx18
-rw-r--r--sc/source/ui/unoobj/appluno.cxx2
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx58
-rw-r--r--sc/source/ui/view/dbfunc3.cxx27
-rw-r--r--sc/source/ui/view/gridwin.cxx16
-rw-r--r--sc/source/ui/view/gridwin2.cxx4
-rw-r--r--sc/source/ui/view/gridwin4.cxx6
-rw-r--r--sc/source/ui/view/tabview3.cxx4
59 files changed, 263 insertions, 292 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 9a1ac59b9a86..9d073ef0f4bc 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -429,7 +429,7 @@ public:
void PreprocessDBDataUpdate(
sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
- const SfxPoolItem* GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
+ const SfxPoolItem& GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
const ScPatternAttr* GetPattern( SCROW nRow ) const;
const ScPatternAttr* GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const;
diff --git a/sc/inc/detdata.hxx b/sc/inc/detdata.hxx
index e222cdd36713..110f4a11e316 100644
--- a/sc/inc/detdata.hxx
+++ b/sc/inc/detdata.hxx
@@ -76,7 +76,7 @@ public:
void Append( ScDetOpData* pData );
ScDetOpDataVector& GetDataVector() { return aDetOpDataVector; }
- const ScDetOpData* GetObject( size_t nPos ) const;
+ const ScDetOpData& GetObject( size_t nPos ) const;
bool HasAddError() const { return bHasAddError; }
size_t Count() const { return aDetOpDataVector.size(); }
diff --git a/sc/inc/dpdimsave.hxx b/sc/inc/dpdimsave.hxx
index 49c400cbabea..3c410643336d 100644
--- a/sc/inc/dpdimsave.hxx
+++ b/sc/inc/dpdimsave.hxx
@@ -111,8 +111,8 @@ public:
bool HasOnlyHidden(const ScDPUniqueStringSet& rVisible);
long GetGroupCount() const;
- const ScDPSaveGroupItem* GetGroupByIndex( long nIndex ) const;
- ScDPSaveGroupItem* GetGroupAccByIndex( long nIndex );
+ const ScDPSaveGroupItem& GetGroupByIndex( long nIndex ) const;
+ ScDPSaveGroupItem& GetGroupAccByIndex( long nIndex );
void Rename( const OUString& rNewName );
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 9004151b6d8a..a167194683a2 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -373,8 +373,8 @@ public:
bool ReloadGroupsInCache(ScDPObject* pDPObj, std::set<ScDPObject*>& rRefs);
SC_DLLPUBLIC size_t GetCount() const;
- SC_DLLPUBLIC ScDPObject* operator[](size_t nIndex);
- SC_DLLPUBLIC const ScDPObject* operator[](size_t nIndex) const;
+ SC_DLLPUBLIC ScDPObject& operator[](size_t nIndex);
+ SC_DLLPUBLIC const ScDPObject& operator[](size_t nIndex) const;
const ScDPObject* GetByName(const OUString& rName) const;
diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx
index 8cba99245fb3..d47e795a0bb1 100644
--- a/sc/inc/userlist.hxx
+++ b/sc/inc/userlist.hxx
@@ -76,8 +76,8 @@ public:
/// If the list in rStr is already inserted
bool HasEntry( const OUString& rStr ) const;
- const ScUserListData* operator[](size_t nIndex) const;
- ScUserListData* operator[](size_t nIndex);
+ const ScUserListData& operator[](size_t nIndex) const;
+ ScUserListData& operator[](size_t nIndex);
ScUserList& operator= ( const ScUserList& r );
bool operator==( const ScUserList& r ) const;
bool operator!=( const ScUserList& r ) const;
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 33431cafc753..f9b35fa391dd 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -1738,7 +1738,7 @@ void ScFiltersTest::testPivotTableBasicODS()
"There should be exactly one pivot table instance.", size_t(1),
pDPs->GetCount());
- const ScDPObject* pDPObj = (*pDPs)[0];
+ const ScDPObject* pDPObj = &(*pDPs)[0];
CPPUNIT_ASSERT_MESSAGE("Failed to get an pivot table object.", pDPObj);
const ScDPSaveData* pSaveData = pDPObj->GetSaveData();
CPPUNIT_ASSERT_MESSAGE("Failed to get ScDPSaveData instance.", pSaveData);
@@ -1795,7 +1795,7 @@ void ScFiltersTest::testPivotTableNamedRangeSourceODS()
ScDPCollection* pDPs = rDoc.GetDPCollection();
CPPUNIT_ASSERT(pDPs->GetCount() == 1);
- ScDPObject* pDP = (*pDPs)[0];
+ ScDPObject* pDP = &(*pDPs)[0];
CPPUNIT_ASSERT(pDP);
// Make sure this pivot table is based on a named range source.
diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx
index 932efd66ddea..9effa0869214 100644
--- a/sc/qa/unit/ucalc_pivottable.cxx
+++ b/sc/qa/unit/ucalc_pivottable.cxx
@@ -2039,8 +2039,7 @@ void Test::testPivotTableDocFunc()
ScDPCollection* pDPs = m_pDoc->GetDPCollection();
CPPUNIT_ASSERT_MESSAGE("Failed to get pivot table collection.", pDPs);
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount());
- pDPObj = (*pDPs)[0];
- CPPUNIT_ASSERT_MESSAGE("Failed to retrieve pivot table object from the collection", pDPObj);
+ pDPObj = &(*pDPs)[0];
ScRange aOutRange = pDPObj->GetOutRange();
{
// Expected output table content. 0 = empty cell
diff --git a/sc/source/core/data/clipcontext.cxx b/sc/source/core/data/clipcontext.cxx
index 9988a483c3fe..ac78dbd6941b 100644
--- a/sc/source/core/data/clipcontext.cxx
+++ b/sc/source/core/data/clipcontext.cxx
@@ -321,7 +321,7 @@ bool CopyFromClipContext::isCloneNotes() const
bool CopyFromClipContext::isDateCell( const ScColumn& rCol, SCROW nRow ) const
{
- sal_uLong nNumIndex = static_cast<const SfxUInt32Item*>(rCol.GetAttr(nRow, ATTR_VALUE_FORMAT))->GetValue();
+ sal_uLong nNumIndex = static_cast<const SfxUInt32Item&>(rCol.GetAttr(nRow, ATTR_VALUE_FORMAT)).GetValue();
short nType = mpClipDoc->GetFormatTable()->GetType(nNumIndex);
return (nType == css::util::NumberFormat::DATE) || (nType == css::util::NumberFormat::TIME) || (nType == css::util::NumberFormat::DATETIME);
}
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index e2d2f00c75fa..846a52f10072 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -372,9 +372,9 @@ const ScPatternAttr* ScColumn::GetPattern( SCROW nRow ) const
return pAttrArray->GetPattern( nRow );
}
-const SfxPoolItem* ScColumn::GetAttr( SCROW nRow, sal_uInt16 nWhich ) const
+const SfxPoolItem& ScColumn::GetAttr( SCROW nRow, sal_uInt16 nWhich ) const
{
- return &pAttrArray->GetPattern( nRow )->GetItemSet().Get(nWhich);
+ return pAttrArray->GetPattern( nRow )->GetItemSet().Get(nWhich);
}
const ScPatternAttr* ScColumn::GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 6c9922605a4f..521ccb389fe2 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2683,7 +2683,7 @@ class MaxStringLenHandler
{
Color* pColor;
OUString aString;
- sal_uInt32 nFormat = static_cast<const SfxUInt32Item*>(mrColumn.GetAttr(nRow, ATTR_VALUE_FORMAT))->GetValue();
+ sal_uInt32 nFormat = static_cast<const SfxUInt32Item&>(mrColumn.GetAttr(nRow, ATTR_VALUE_FORMAT)).GetValue();
ScCellFormat::GetString(rCell, nFormat, aString, &pColor, *mpFormatter, &mrColumn.GetDoc());
sal_Int32 nLen = 0;
if (mbOctetEncoding)
@@ -2789,8 +2789,8 @@ class MaxNumStringLenHandler
OUString aString;
OUString aSep;
sal_uInt16 nPrec;
- sal_uInt32 nFormat = static_cast<const SfxUInt32Item*>(
- mrColumn.GetAttr(nRow, ATTR_VALUE_FORMAT))->GetValue();
+ sal_uInt32 nFormat = static_cast<const SfxUInt32Item&>(
+ mrColumn.GetAttr(nRow, ATTR_VALUE_FORMAT)).GetValue();
if (nFormat % SV_COUNTRY_LANGUAGE_OFFSET)
{
aSep = mpFormatter->GetFormatDecimalSep(nFormat);
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index da216f2a3379..5e3df16ef625 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -338,8 +338,8 @@ ScDPObject* ScDocument::GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
sal_uInt16 nCount = pDPCollection->GetCount();
ScAddress aPos( nCol, nRow, nTab );
for (sal_uInt16 i=0; i<nCount; i++)
- if ( (*pDPCollection)[i]->GetOutRange().In( aPos ) )
- return (*pDPCollection)[i];
+ if ( (*pDPCollection)[i].GetOutRange().In( aPos ) )
+ return &(*pDPCollection)[i];
return NULL;
}
@@ -353,8 +353,8 @@ ScDPObject* ScDocument::GetDPAtBlock( const ScRange & rBlock ) const
* approximation of MS Excels 'most recent' effect. */
sal_uInt16 i = pDPCollection->GetCount();
while ( i-- > 0 )
- if ( (*pDPCollection)[i]->GetOutRange().In( rBlock ) )
- return (*pDPCollection)[i];
+ if ( (*pDPCollection)[i].GetOutRange().In( rBlock ) )
+ return &(*pDPCollection)[i];
return NULL;
}
diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx
index ef27c121df93..629c1a544dd9 100644
--- a/sc/source/core/data/dpdimsave.cxx
+++ b/sc/source/core/data/dpdimsave.cxx
@@ -207,14 +207,14 @@ long ScDPSaveGroupDimension::GetGroupCount() const
return aGroups.size();
}
-const ScDPSaveGroupItem* ScDPSaveGroupDimension::GetGroupByIndex( long nIndex ) const
+const ScDPSaveGroupItem& ScDPSaveGroupDimension::GetGroupByIndex( long nIndex ) const
{
- return const_cast< ScDPSaveGroupDimension* >( this )->GetGroupAccByIndex( nIndex );
+ return aGroups[nIndex];
}
-ScDPSaveGroupItem* ScDPSaveGroupDimension::GetGroupAccByIndex( long nIndex )
+ScDPSaveGroupItem& ScDPSaveGroupDimension::GetGroupAccByIndex( long nIndex )
{
- return &aGroups[nIndex];
+ return aGroups[nIndex];
}
void ScDPSaveGroupDimension::RemoveFromGroups( const OUString& rItemName )
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index ab982c4ef6c8..009c60dcd24f 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -3570,14 +3570,14 @@ size_t ScDPCollection::GetCount() const
return maTables.size();
}
-ScDPObject* ScDPCollection::operator [](size_t nIndex)
+ScDPObject& ScDPCollection::operator [](size_t nIndex)
{
- return &maTables[nIndex];
+ return maTables[nIndex];
}
-const ScDPObject* ScDPCollection::operator [](size_t nIndex) const
+const ScDPObject& ScDPCollection::operator [](size_t nIndex) const
{
- return &maTables[nIndex];
+ return maTables[nIndex];
}
const ScDPObject* ScDPCollection::GetByName(const OUString& rName) const
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 4659d287bdfa..92ad6231282d 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1825,7 +1825,7 @@ void ScTable::ResetChanged( const ScRange& rRange )
const SfxPoolItem* ScTable::GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const
{
if (ValidColRow(nCol,nRow))
- return aCol[nCol].GetAttr( nRow, nWhich );
+ return &aCol[nCol].GetAttr( nRow, nWhich );
else
return NULL;
}
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 1be0c8f1d92a..896b59b6dd6f 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1500,22 +1500,17 @@ short ScTable::CompareCell(
if (bUserDef)
{
ScUserList* pList = ScGlobal::GetUserList();
- const ScUserListData* pData = (*pList)[aSortParam.nUserIndex];
+ const ScUserListData& rData = (*pList)[aSortParam.nUserIndex];
- if (pData)
+ if ( bNaturalSort )
+ nRes = naturalsort::Compare( aStr1, aStr2, bCaseSens, &rData, pSortCollator );
+ else
{
- if ( bNaturalSort )
- nRes = naturalsort::Compare( aStr1, aStr2, bCaseSens, pData, pSortCollator );
+ if ( bCaseSens )
+ nRes = sal::static_int_cast<short>( rData.Compare(aStr1, aStr2) );
else
- {
- if ( bCaseSens )
- nRes = sal::static_int_cast<short>( pData->Compare(aStr1, aStr2) );
- else
- nRes = sal::static_int_cast<short>( pData->ICompare(aStr1, aStr2) );
- }
+ nRes = sal::static_int_cast<short>( rData.ICompare(aStr1, aStr2) );
}
- else
- bUserDef = false;
}
if (!bUserDef)
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx
index b1015806bd62..8b8a6f161857 100644
--- a/sc/source/core/tool/appoptio.cxx
+++ b/sc/source/core/tool/appoptio.cxx
@@ -201,7 +201,7 @@ static void lcl_GetSortList( Any& rDest )
Sequence<OUString> aSeq( nCount );
OUString* pArray = aSeq.getArray();
for (size_t i=0; i<nCount; ++i)
- pArray[i] = (*pUserList)[sal::static_int_cast<sal_uInt16>(i)]->GetString();
+ pArray[i] = (*pUserList)[sal::static_int_cast<sal_uInt16>(i)].GetString();
rDest <<= aSeq;
}
else
diff --git a/sc/source/core/tool/detdata.cxx b/sc/source/core/tool/detdata.cxx
index e7fb6c43287a..3cdd04370958 100644
--- a/sc/source/core/tool/detdata.cxx
+++ b/sc/source/core/tool/detdata.cxx
@@ -86,9 +86,9 @@ bool ScDetOpList::operator==( const ScDetOpList& r ) const
return bEqual;
}
-const ScDetOpData* ScDetOpList::GetObject( size_t nPos ) const
+const ScDetOpData& ScDetOpList::GetObject( size_t nPos ) const
{
- return &aDetOpDataVector[nPos];
+ return aDetOpDataVector[nPos];
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index 411a2fdf5c8c..a140fa9ee19b 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -279,14 +279,14 @@ const ScUserListData* ScUserList::GetData(const OUString& rSubStr) const
return NULL;
}
-const ScUserListData* ScUserList::operator[](size_t nIndex) const
+const ScUserListData& ScUserList::operator[](size_t nIndex) const
{
- return &maData[nIndex];
+ return maData[nIndex];
}
-ScUserListData* ScUserList::operator[](size_t nIndex)
+ScUserListData& ScUserList::operator[](size_t nIndex)
{
- return &maData[nIndex];
+ return maData[nIndex];
}
ScUserList& ScUserList::operator=( const ScUserList& r )
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index ed8981afe66e..ce349fe1af4c 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -812,7 +812,7 @@ void XclImpAutoFilterData::CreateScDBData()
// or if we need to create the Advanced Filter.
if( bActive || bCriteria)
{
- ScDocument* pDoc = pExcRoot->pIR->GetDocPtr();
+ ScDocument& rDoc = pExcRoot->pIR->GetDocRef();
OUString aNewName(STR_DB_LOCAL_NONAME);
pCurrDBData = new ScDBData(aNewName , Tab(),
StartCol(),StartRow(), EndCol(),EndRow() );
@@ -825,7 +825,7 @@ void XclImpAutoFilterData::CreateScDBData()
}
else
pCurrDBData->SetAdvancedQuerySource(NULL);
- pDoc->SetAnonymousDBData(Tab(), pCurrDBData);
+ rDoc.SetAnonymousDBData(Tab(), pCurrDBData);
}
}
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index c33de19331a0..c981c3d2a716 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -896,8 +896,8 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > x
// Compile the range representation string into token array. Note that the
// source range text depends on the current grammar.
OUString aRangeRepr = xDataSeq->getSourceRangeRepresentation();
- ScCompiler aComp( GetDocPtr(), ScAddress() );
- aComp.SetGrammar( GetDocPtr()->GetGrammar() );
+ ScCompiler aComp( &GetDocRef(), ScAddress() );
+ aComp.SetGrammar( GetDocRef().GetGrammar() );
boost::scoped_ptr<ScTokenArray> pArray(aComp.CompileString(aRangeRepr));
if( !pArray )
return nDefCount;
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index c0d1cf0583ed..6c2601fe31ac 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -166,7 +166,7 @@ static void lcl_GetFromTo( const XclExpRoot& rRoot, const Rectangle &aRect, sal_
while(true)
{
- Rectangle r = rRoot.GetDocPtr()->GetMMRect( nCol,nRow,nCol,nRow,nTab );
+ Rectangle r = rRoot.GetDocRef().GetMMRect( nCol,nRow,nCol,nRow,nTab );
if( !bTo )
{
if( r.Left() <= aRect.Left() )
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index 5fcfbe443e96..2f1c6222415b 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -594,7 +594,7 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokA
{
// clone the passed token array, convert references relative to current cell position
mxData->mxOwnScTokArr.reset( rScTokArr.Clone() );
- ScCompiler::MoveRelWrap( *mxData->mxOwnScTokArr, GetDocPtr(), *pScBasePos, MAXCOL, MAXROW );
+ ScCompiler::MoveRelWrap( *mxData->mxOwnScTokArr, &GetDocRef(), *pScBasePos, MAXCOL, MAXROW );
// don't remember pScBasePos in mxData->mpScBasePos, shared formulas use real relative refs
}
break;
diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx
index 4466a1e12584..d6347bc98fe2 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -369,7 +369,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertBuiltInName( sal_Unicode cBuiltIn, XclTo
XclExpNameRef xName( new XclExpName( GetRoot(), cBuiltIn ) );
xName->SetTokenArray( xTokArr );
xName->SetLocalTab( aRange.aStart.Tab() );
- OUString sSymbol(aRange.Format(SCR_ABS_3D, GetDocPtr(), ScAddress::Details( ::formula::FormulaGrammar::CONV_XL_A1)));
+ OUString sSymbol(aRange.Format(SCR_ABS_3D, &GetDocRef(), ScAddress::Details( ::formula::FormulaGrammar::CONV_XL_A1)));
xName->SetSymbol( sSymbol );
return Append( xName );
}
@@ -380,7 +380,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertBuiltInName( sal_Unicode cBuiltIn, XclTo
xName->SetTokenArray( xTokArr );
xName->SetLocalTab( nScTab );
OUString sSymbol;
- rRangeList.Format( sSymbol, SCR_ABS_3D, GetDocPtr(), ::formula::FormulaGrammar::CONV_XL_A1 );
+ rRangeList.Format( sSymbol, SCR_ABS_3D, &GetDocRef(), ::formula::FormulaGrammar::CONV_XL_A1 );
xName->SetSymbol( sSymbol );
return Append( xName );
}
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 71ca74523386..78b4b32b6b1b 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -368,24 +368,22 @@ void XclExpPCField::InitStdGroupField( const XclExpPCField& rBaseField, const Sc
// loop over all groups of this field
for( long nGroupIdx = 0, nGroupCount = rGroupDim.GetGroupCount(); nGroupIdx < nGroupCount; ++nGroupIdx )
{
- if( const ScDPSaveGroupItem* pGroupItem = rGroupDim.GetGroupByIndex( nGroupIdx ) )
+ const ScDPSaveGroupItem& rGroupItem = rGroupDim.GetGroupByIndex( nGroupIdx );
+ // the index of the new item containing the grouping name
+ sal_uInt16 nGroupItemIdx = EXC_PC_NOITEM;
+ // loop over all elements of one group
+ for( size_t nElemIdx = 0, nElemCount = rGroupItem.GetElementCount(); nElemIdx < nElemCount; ++nElemIdx )
{
- // the index of the new item containing the grouping name
- sal_uInt16 nGroupItemIdx = EXC_PC_NOITEM;
- // loop over all elements of one group
- for( size_t nElemIdx = 0, nElemCount = pGroupItem->GetElementCount(); nElemIdx < nElemCount; ++nElemIdx )
+ if (const OUString* pElemName = rGroupItem.GetElementByIndex(nElemIdx))
{
- if (const OUString* pElemName = pGroupItem->GetElementByIndex(nElemIdx))
+ // try to find the item that is part of the group in the base field
+ sal_uInt16 nBaseItemIdx = rBaseField.GetItemIndex( *pElemName );
+ if( nBaseItemIdx < maFieldInfo.mnBaseItems )
{
- // try to find the item that is part of the group in the base field
- sal_uInt16 nBaseItemIdx = rBaseField.GetItemIndex( *pElemName );
- if( nBaseItemIdx < maFieldInfo.mnBaseItems )
- {
- // add group name item only if there are any valid base items
- if( nGroupItemIdx == EXC_PC_NOITEM )
- nGroupItemIdx = InsertGroupItem( new XclExpPCItem( pGroupItem->GetGroupName() ) );
- maGroupOrder[ nBaseItemIdx ] = nGroupItemIdx;
- }
+ // add group name item only if there are any valid base items
+ if( nGroupItemIdx == EXC_PC_NOITEM )
+ nGroupItemIdx = InsertGroupItem( new XclExpPCItem( rGroupItem.GetGroupName() ) );
+ maGroupOrder[ nBaseItemIdx ] = nGroupItemIdx;
}
}
}
@@ -522,7 +520,7 @@ void XclExpPCField::InsertNumDateGroupItems( const ScDPObject& rDPObj, const ScD
if (!pCache)
return;
- ScSheetDPData aDPData(GetDocPtr(), *pSrcDesc, *pCache);
+ ScSheetDPData aDPData(&GetDocRef(), *pSrcDesc, *pCache);
long nDim = GetFieldIndex();
// get the string collection with generated grouping elements
ScDPNumGroupDimension aTmpDim( rNumInfo );
@@ -1634,9 +1632,11 @@ void XclExpPivotTableManager::CreatePivotTables()
{
if( ScDPCollection* pDPColl = GetDoc().GetDPCollection() )
for( size_t nDPObj = 0, nCount = pDPColl->GetCount(); nDPObj < nCount; ++nDPObj )
- if( ScDPObject* pDPObj = (*pDPColl)[ nDPObj ] )
- if( const XclExpPivotCache* pPCache = CreatePivotCache( *pDPObj ) )
- maPTableList.AppendNewRecord( new XclExpPivotTable( GetRoot(), *pDPObj, *pPCache, nDPObj ) );
+ {
+ ScDPObject& rDPObj = (*pDPColl)[ nDPObj ];
+ if( const XclExpPivotCache* pPCache = CreatePivotCache( rDPObj ) )
+ maPTableList.AppendNewRecord( new XclExpPivotTable( GetRoot(), rDPObj, *pPCache, nDPObj ) );
+ }
}
XclExpRecordRef XclExpPivotTableManager::CreatePivotCachesRecord()
diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx
index fa04e1f2558b..52de28cd6a82 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -318,17 +318,16 @@ void XclExpXmlPivotTableManager::Initialize()
for (size_t i = 0, n = pDPColl->GetCount(); i < n; ++i)
{
- const ScDPObject* pDPObj = (*pDPColl)[i];
- assert(pDPObj); // We don't store NULL here.
+ const ScDPObject& rDPObj = (*pDPColl)[i];
// Get the cache ID for this pivot table.
- CacheIdMapType::iterator itCache = maCacheIdMap.find(pDPObj);
+ CacheIdMapType::iterator itCache = maCacheIdMap.find(&rDPObj);
if (itCache == maCacheIdMap.end())
// No cache ID found. Something is wrong here....
continue;
sal_Int32 nCacheId = itCache->second;
- SCTAB nTab = pDPObj->GetOutRange().aStart.Tab();
+ SCTAB nTab = rDPObj.GetOutRange().aStart.Tab();
TablesType::iterator it = maTables.find(nTab);
if (it == maTables.end())
@@ -340,7 +339,7 @@ void XclExpXmlPivotTableManager::Initialize()
}
XclExpXmlPivotTables* p = it->second;
- p->AppendTable(pDPObj, nCacheId, i+1);
+ p->AppendTable(&rDPObj, nCacheId, i+1);
}
maCaches.SetCaches(aCaches);
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 6449ae2a6b8c..1908a0ea0d00 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -834,7 +834,7 @@ Reference< XDataSequence > XclImpChSourceLink::CreateDataSequence( const OUStrin
{
if ( mxTokenArray )
{
- ScCompiler aComp( GetDocPtr(), ScAddress(), *mxTokenArray );
+ ScCompiler aComp( &GetDocRef(), ScAddress(), *mxTokenArray );
aComp.SetGrammar(GetDoc().GetGrammar());
OUStringBuffer aRangeRep;
aComp.CreateStringFromTokenArray( aRangeRep );
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 3b10649baf60..d821a8ad5266 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -654,13 +654,13 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
if( !mxScCondFmt.get() )
{
sal_uLong nKey = 0;
- mxScCondFmt.reset( new ScConditionalFormat( nKey, GetDocPtr() ) );
+ mxScCondFmt.reset( new ScConditionalFormat( nKey, &GetDocRef() ) );
if(maRanges.size() > 1)
maRanges.Join(*maRanges[0], true);
mxScCondFmt->SetRange(maRanges);
}
- ScCondFormatEntry* pEntry = new ScCondFormatEntry( eMode, xTokArr1.get(), pTokArr2.get(), GetDocPtr(), rPos, aStyleName );
+ ScCondFormatEntry* pEntry = new ScCondFormatEntry( eMode, xTokArr1.get(), pTokArr2.get(), &GetDocRef(), rPos, aStyleName );
mxScCondFmt->AddEntry( pEntry );
++mnCondIndex;
}
diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx
index c1bee5af50f6..bb93e8865904 100644
--- a/sc/source/filter/excel/xiname.cxx
+++ b/sc/source/filter/excel/xiname.cxx
@@ -236,7 +236,7 @@ void XclImpName::ConvertTokens()
void XclImpName::InsertName(const ScTokenArray* pArray)
{
// create the Calc name data
- ScRangeData* pData = new ScRangeData(GetDocPtr(), maScName, *pArray, ScAddress(), meNameType);
+ ScRangeData* pData = new ScRangeData(&GetDocRef(), maScName, *pArray, ScAddress(), meNameType);
pData->GuessPosition(); // calculate base position for relative refs
pData->SetIndex( mnNameIndex ); // used as unique identifier in formulas
if (mnXclTab == EXC_NAME_GLOBAL)
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index 48fe3b30cd0e..aa8c7de34ca1 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -1399,7 +1399,7 @@ void XclImpPivotTable::Convert()
// *** insert into Calc document ***
// create source descriptor
- ScSheetSourceDesc aDesc(GetDocPtr());
+ ScSheetSourceDesc aDesc(&GetDocRef());
const OUString& rSrcName = mxPCache->GetSourceRangeName();
if (!rSrcName.isEmpty())
// Range name is the data source.
@@ -1417,7 +1417,7 @@ void XclImpPivotTable::Convert()
}
// create the DataPilot
- ScDPObject* pDPObj = new ScDPObject( GetDocPtr() );
+ ScDPObject* pDPObj = new ScDPObject( &GetDocRef() );
pDPObj->SetName( maPTInfo.maTableName );
if (!maPTInfo.maDataName.isEmpty())
aSaveData.GetDataLayoutDimension()->SetLayoutName(maPTInfo.maDataName);
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index df3f4d69d199..551e035d80c8 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -271,9 +271,9 @@ ScDocument& XclRoot::GetDoc() const
return mrData.mrDoc;
}
-ScDocument* XclRoot::GetDocPtr() const
+ScDocument& XclRoot::GetDocRef() const
{
- return &mrData.mrDoc;
+ return mrData.mrDoc;
}
SfxObjectShell* XclRoot::GetDocShell() const
diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx
index d65ccf08bd42..7e98ed86c653 100644
--- a/sc/source/filter/inc/xlroot.hxx
+++ b/sc/source/filter/inc/xlroot.hxx
@@ -206,7 +206,7 @@ public:
/** Returns the destination document (import) or source document (export). */
ScDocument& GetDoc() const;
/** Returns pointer to the destination document (import) or source document (export). */
- ScDocument* GetDocPtr() const;
+ ScDocument& GetDocRef() const;
/** Returns the object shell of the Calc document. May be 0 (i.e. import from clipboard). */
SfxObjectShell* GetDocShell() const;
diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
index 417aa3f80720..0dd38ebeb36c 100644
--- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
@@ -58,7 +58,7 @@ XclImpChangeTrack::XclImpChangeTrack( const XclImpRoot& rRoot, const XclImpStrea
xInStrm->Seek( STREAM_SEEK_TO_BEGIN );
pStrm = new XclImpStream( *xInStrm, GetRoot() );
pStrm->CopyDecrypterFrom( rBookStrm );
- pChangeTrack = new ScChangeTrack( GetDocPtr() );
+ pChangeTrack = new ScChangeTrack( &GetDocRef() );
sOldUsername = pChangeTrack->GetUser();
pChangeTrack->SetUseFixDateTime( true );
@@ -273,7 +273,7 @@ void XclImpChangeTrack::ReadCell(
if( pStrm->IsValid() && pTokenArray )
{
rCell.meType = CELLTYPE_FORMULA;
- rCell.mpFormula = new ScFormulaCell(GetDocPtr(), rPosition, *pTokenArray);
+ rCell.mpFormula = new ScFormulaCell(&GetDocRef(), rPosition, *pTokenArray);
}
delete pTokenArray;
}
diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx
index a17ac85c290b..69195c54a67e 100644
--- a/sc/source/filter/xcl97/xcl97esc.cxx
+++ b/sc/source/filter/xcl97/xcl97esc.cxx
@@ -206,7 +206,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape
//added for exporting OCX control
sal_Int16 nMsCtlType = 0;
if ( !pObj )
- pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, GetDocPtr() ); // just what is it?!?
+ pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDocRef() ); // just what is it?!?
else
{
pCurrXclObj = NULL;
@@ -231,10 +231,10 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape
pCurrXclObj = new XclObjOle( mrObjMgr, *pObj );
}
else // just a metafile
- pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, GetDocPtr() );
+ pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDocRef() );
}
else
- pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, GetDocPtr() );
+ pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDocRef() );
}
else if( nObjType == OBJ_UNO )
{
@@ -255,13 +255,13 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape
else //TBX Form Control
pCurrXclObj = CreateTBXCtrlObj( rxShape, pChildAnchor );
if( !pCurrXclObj )
- pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, GetDocPtr() ); // just a metafile
+ pCurrXclObj = new XclObjAny( mrObjMgr, rxShape, &GetDocRef() ); // just a metafile
}
else if( !ScDrawLayer::IsNoteCaption( pObj ) )
{
// ignore permanent note shapes
// #i12190# do not ignore callouts (do not filter by object type ID)
- pCurrXclObj = ShapeInteractionHelper::CreateShapeObj( mrObjMgr, rxShape, GetDocPtr() );
+ pCurrXclObj = ShapeInteractionHelper::CreateShapeObj( mrObjMgr, rxShape, &GetDocRef() );
ShapeInteractionHelper::PopulateShapeInteractionInfo( mrObjMgr, rxShape, *pCurrAppData );
}
}
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx
index 6ca6cf06699a..7a605a4f3bfc 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -653,20 +653,17 @@ void ScXMLExportDataPilot::WriteGroupDimElements(ScDPSaveDimension* pDim, const
sal_Int32 nCount = pGroupDim->GetGroupCount();
for (sal_Int32 i = 0; i < nCount; ++i)
{
- const ScDPSaveGroupItem* pGroup = pGroupDim->GetGroupByIndex( i );
- if (pGroup)
+ const ScDPSaveGroupItem& rGroup = pGroupDim->GetGroupByIndex( i );
+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, rGroup.GetGroupName());
+ SvXMLElementExport aElemDPG(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP, true, true);
+ sal_Int32 nElemCount = rGroup.GetElementCount();
+ for(sal_Int32 j = 0; j < nElemCount; ++j)
{
- rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, pGroup->GetGroupName());
- SvXMLElementExport aElemDPG(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP, true, true);
- sal_Int32 nElemCount = pGroup->GetElementCount();
- for(sal_Int32 j = 0; j < nElemCount; ++j)
+ const OUString* pElem = rGroup.GetElementByIndex(j);
+ if (pElem)
{
- const OUString* pElem = pGroup->GetElementByIndex(j);
- if (pElem)
- {
- rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, *pElem);
- SvXMLElementExport aElemDPM(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP_MEMBER, true, true);
- }
+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, *pElem);
+ SvXMLElementExport aElemDPM(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP_MEMBER, true, true);
}
}
}
@@ -757,11 +754,11 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads
rExport.CheckAttrList();
for (size_t i = 0; i < nDPCount; ++i)
{
- ScDPSaveData* pDPSave = (*pDPs)[i]->GetSaveData();
+ ScDPSaveData* pDPSave = (*pDPs)[i].GetSaveData();
if (!pDPSave)
continue;
- ScRange aOutRange((*pDPs)[i]->GetOutRange());
+ ScRange aOutRange((*pDPs)[i].GetOutRange());
OUString sTargetRangeAddress;
ScRangeStringConverter::GetStringFromRange( sTargetRangeAddress, aOutRange, pDoc, ::formula::FormulaGrammar::CONV_OOO );
ScDocAttrIterator aAttrItr(pDoc, aOutRange.aStart.Tab(),
@@ -785,8 +782,8 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads
}
pAttr = aAttrItr.GetNext(nCol, nRow1, nRow2);
}
- OUString sName((*pDPs)[i]->GetName());
- OUString sApplicationData((*pDPs)[i]->GetTag());
+ OUString sName((*pDPs)[i].GetName());
+ OUString sApplicationData((*pDPs)[i].GetTag());
bool bRowGrand = pDPSave->GetRowGrand();
bool bColumnGrand = pDPSave->GetColumnGrand();
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, sName);
@@ -810,7 +807,7 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SHOW_FILTER_BUTTON, XML_FALSE);
if (!pDPSave->GetDrillDown())
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DRILL_DOWN_ON_DOUBLE_CLICK, XML_FALSE);
- if ((*pDPs)[i]->GetHeaderLayout())
+ if ((*pDPs)[i].GetHeaderLayout())
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_HEADER_GRID_LAYOUT, XML_TRUE);
SvXMLElementExport aElemDP(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_TABLE, true, true);
@@ -833,9 +830,9 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads
}
rExport.CheckAttrList();
- if ((*pDPs)[i]->IsSheetData())
+ if ((*pDPs)[i].IsSheetData())
{
- const ScSheetSourceDesc* pSheetSource = (*pDPs)[i]->GetSheetDesc();
+ const ScSheetSourceDesc* pSheetSource = (*pDPs)[i].GetSheetDesc();
if (rExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012)
{
@@ -854,9 +851,9 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads
rExport.CheckAttrList();
WriteDPFilter(pSheetSource->GetQueryParam());
}
- else if ((*pDPs)[i]->IsImportData())
+ else if ((*pDPs)[i].IsImportData())
{
- const ScImportSourceDesc* pImpSource = (*pDPs)[i]->GetImportSourceDesc();
+ const ScImportSourceDesc* pImpSource = (*pDPs)[i].GetImportSourceDesc();
switch (pImpSource->nType)
{
case sheet::DataImportMode_NONE : break;
@@ -888,9 +885,9 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads
break;
}
}
- else if ((*pDPs)[i]->IsServiceData())
+ else if ((*pDPs)[i].IsServiceData())
{
- const ScDPServiceDesc* pServSource = (*pDPs)[i]->GetDPServiceDesc();
+ const ScDPServiceDesc* pServSource = (*pDPs)[i].GetDPServiceDesc();
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, pServSource->aServiceName);
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SOURCE_NAME, pServSource->aParSource);
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_OBJECT_NAME, pServSource->aParName);
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 652823a10e5d..969df4af1780 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -734,19 +734,16 @@ void ScXMLExport::GetDetectiveOpList( ScMyDetectiveOpContainer& rDetOp )
size_t nCount = pOpList->Count();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex )
{
- const ScDetOpData* pDetData = pOpList->GetObject( nIndex);
- if( pDetData )
+ const ScDetOpData& rDetData = pOpList->GetObject( nIndex);
+ const ScAddress& rDetPos = rDetData.GetPos();
+ SCTAB nTab = rDetPos.Tab();
+ if ( nTab < pDoc->GetTableCount() )
{
- const ScAddress& rDetPos = pDetData->GetPos();
- SCTAB nTab = rDetPos.Tab();
- if ( nTab < pDoc->GetTableCount() )
- {
- rDetOp.AddOperation( pDetData->GetOperation(), rDetPos, static_cast<sal_uInt32>( nIndex) );
+ rDetOp.AddOperation( rDetData.GetOperation(), rDetPos, static_cast<sal_uInt32>( nIndex) );
- // cells with detective operations are written even if empty
- pSharedData->SetLastColumn( nTab, rDetPos.Col() );
- pSharedData->SetLastRow( nTab, rDetPos.Row() );
- }
+ // cells with detective operations are written even if empty
+ pSharedData->SetLastColumn( nTab, rDetPos.Col() );
+ pSharedData->SetLastRow( nTab, rDetPos.Row() );
}
}
rDetOp.Sort();
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 2b6be65a197a..e2a7bc0d9453 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -333,16 +333,16 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew )
ScTabViewShell* pDocView = pRefViewSh ? pRefViewSh : pActiveViewSh;
if ( pDocView && pRangeFindList && nIndex < pRangeFindList->Count() )
{
- ScRangeFindData* pData = pRangeFindList->GetObject( nIndex );
- sal_Int32 nOldStart = pData->nSelStart;
- sal_Int32 nOldEnd = pData->nSelEnd;
+ ScRangeFindData& rData = pRangeFindList->GetObject( nIndex );
+ sal_Int32 nOldStart = rData.nSelStart;
+ sal_Int32 nOldEnd = rData.nSelEnd;
ColorData nNewColor = pRangeFindList->FindColor( rNew, nIndex );
ScRange aJustified = rNew;
aJustified.Justify(); // Always display Ref in the Formula the right way
ScDocument* pDoc = pDocView->GetViewData().GetDocument();
const ScAddress::Details aAddrDetails( pDoc, aCursorPos );
- OUString aNewStr(aJustified.Format(pData->nFlags, pDoc, aAddrDetails));
+ OUString aNewStr(aJustified.Format(rData.nFlags, pDoc, aAddrDetails));
ESelection aOldSel( 0, nOldStart, 0, nOldEnd );
SfxItemSet aSet( pEngine->GetEmptyItemSet() );
@@ -359,16 +359,16 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew )
long nDiff = aNewStr.getLength() - (long)(nOldEnd-nOldStart);
- pData->aRef = rNew;
- pData->nSelEnd = pData->nSelEnd + nDiff;
- pData->nColorData = nNewColor;
+ rData.aRef = rNew;
+ rData.nSelEnd = rData.nSelEnd + nDiff;
+ rData.nColorData = nNewColor;
sal_uInt16 nCount = (sal_uInt16) pRangeFindList->Count();
for (sal_uInt16 i=nIndex+1; i<nCount; i++)
{
- ScRangeFindData* pNext = pRangeFindList->GetObject( i );
- pNext->nSelStart = pNext->nSelStart + nDiff;
- pNext->nSelEnd = pNext->nSelEnd + nDiff;
+ ScRangeFindData& rNext = pRangeFindList->GetObject( i );
+ rNext.nSelStart = rNext.nSelStart + nDiff;
+ rNext.nSelEnd = rNext.nSelEnd + nDiff;
}
EditView* pActiveView = pTopView ? pTopView : pTableView;
diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index 83fdfdf91e5f..812a786c6dd5 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -629,9 +629,9 @@ bool ScPivotLayoutDialog::IsDataElement(SCCOL nColumn)
return mpListBoxField->IsDataElement(nColumn);
}
-ScDPLabelData* ScPivotLayoutDialog::GetLabelData(SCCOL nColumn)
+ScDPLabelData& ScPivotLayoutDialog::GetLabelData(SCCOL nColumn)
{
- return &maPivotParameters.maLabelArray[nColumn];
+ return maPivotParameters.maLabelArray[nColumn];
}
void ScPivotLayoutDialog::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames)
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
index b217aece02c3..30c42c5c65b8 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
@@ -49,9 +49,7 @@ bool ScPivotLayoutTreeList::DoubleClickHdl()
return false;
SCCOL nCurrentColumn = rCurrentFunctionData.mnCol;
- ScDPLabelData* pCurrentLabelData = mpParent->GetLabelData(nCurrentColumn);
- if (!pCurrentLabelData)
- return false;
+ ScDPLabelData& rCurrentLabelData = mpParent->GetLabelData(nCurrentColumn);
ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create();
@@ -59,11 +57,11 @@ bool ScPivotLayoutTreeList::DoubleClickHdl()
mpParent->PushDataFieldNames(aDataFieldNames);
boost::scoped_ptr<AbstractScDPSubtotalDlg> pDialog(
- pFactory->CreateScDPSubtotalDlg(this, mpParent->maPivotTableObject, *pCurrentLabelData, rCurrentFunctionData, aDataFieldNames, true));
+ pFactory->CreateScDPSubtotalDlg(this, mpParent->maPivotTableObject, rCurrentLabelData, rCurrentFunctionData, aDataFieldNames, true));
if (pDialog->Execute() == RET_OK)
{
- pDialog->FillLabelData(*pCurrentLabelData);
+ pDialog->FillLabelData(rCurrentLabelData);
rCurrentFunctionData.mnFuncMask = pDialog->GetFuncMask();
}
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index 360c62efd44e..a45b650135ef 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -77,29 +77,27 @@ bool ScPivotLayoutTreeListData::DoubleClickHdl()
ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData;
SCCOL nCurrentColumn = rCurrentFunctionData.mnCol;
- ScDPLabelData* pCurrentLabelData = mpParent->GetLabelData(nCurrentColumn);
- if (!pCurrentLabelData)
- return false;
+ ScDPLabelData& rCurrentLabelData = mpParent->GetLabelData(nCurrentColumn);
ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create();
boost::scoped_ptr<AbstractScDPFunctionDlg> pDialog(
- pFactory->CreateScDPFunctionDlg(this, mpParent->GetLabelDataVector(), *pCurrentLabelData, rCurrentFunctionData));
+ pFactory->CreateScDPFunctionDlg(this, mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData));
if (pDialog->Execute() == RET_OK)
{
rCurrentFunctionData.mnFuncMask = pDialog->GetFuncMask();
- pCurrentLabelData->mnFuncMask = pDialog->GetFuncMask();
+ rCurrentLabelData.mnFuncMask = pDialog->GetFuncMask();
rCurrentFunctionData.maFieldRef = pDialog->GetFieldRef();
- ScDPLabelData* pDFData = mpParent->GetLabelData(rCurrentFunctionData.mnCol);
+ ScDPLabelData& rDFData = mpParent->GetLabelData(rCurrentFunctionData.mnCol);
AdjustDuplicateCount(pCurrentItemValue);
OUString sDataItemName = lclCreateDataItemName(
rCurrentFunctionData.mnFuncMask,
- pDFData->maName,
+ rDFData.maName,
rCurrentFunctionData.mnDupCount);
SetEntryText(GetCurEntry(), sDataItemName);
@@ -152,12 +150,12 @@ void ScPivotLayoutTreeListData::PushDataFieldNames(vector<ScDPName>& rDataFieldN
ScItemValue* pEachItemValue = static_cast<ScItemValue*>(pLoopEntry->GetUserData());
SCCOL nColumn = pEachItemValue->maFunctionData.mnCol;
- ScDPLabelData* pLabelData = mpParent->GetLabelData(nColumn);
+ ScDPLabelData& rLabelData = mpParent->GetLabelData(nColumn);
- if (pLabelData == NULL || pLabelData->maName.isEmpty())
+ if (rLabelData.maName.isEmpty())
continue;
- OUString sLayoutName = pLabelData->maLayoutName;
+ OUString sLayoutName = rLabelData.maLayoutName;
if (sLayoutName.isEmpty())
{
sLayoutName = lclCreateDataItemName(
@@ -166,7 +164,7 @@ void ScPivotLayoutTreeListData::PushDataFieldNames(vector<ScDPName>& rDataFieldN
pEachItemValue->maFunctionData.mnDupCount);
}
- rDataFieldNames.push_back(ScDPName(pLabelData->maName, sLayoutName, pLabelData->mnDupCount));
+ rDataFieldNames.push_back(ScDPName(rLabelData.maName, sLayoutName, rLabelData.mnDupCount));
}
}
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 85661d1067a2..296c53fe08ae 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -841,7 +841,7 @@ void ScTabPageSortOptions::FillUserSortListBox()
size_t nCount = pUserLists->size();
if ( nCount > 0 )
for ( size_t i=0; i<nCount; ++i )
- m_pLbSortUser->InsertEntry( (*pUserLists)[i]->GetString() );
+ m_pLbSortUser->InsertEntry( (*pUserLists)[i].GetString() );
}
}
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index 2b2ba2162a55..923e6fb2d7f5 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -558,7 +558,7 @@ void ScTpSubTotalOptions::FillUserSortListBox()
{
size_t nCount = pUserLists->size();
for ( size_t i=0; i<nCount; ++i )
- pLbUserDef->InsertEntry( (*pUserLists)[i]->GetString() );
+ pLbUserDef->InsertEntry( (*pUserLists)[i].GetString() );
}
}
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index ff9f8c2713dd..3e8752b4954b 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -471,33 +471,30 @@ bool ScDocFunc::DetectiveRefresh( bool bAutomatic )
size_t nCount = pList->Count();
for (size_t i=0; i < nCount; ++i)
{
- const ScDetOpData* pData = pList->GetObject(i);
- if (pData)
+ const ScDetOpData& rData = pList->GetObject(i);
+ ScAddress aPos = rData.GetPos();
+ ScDetectiveFunc aFunc( &rDoc, aPos.Tab() );
+ SCCOL nCol = aPos.Col();
+ SCROW nRow = aPos.Row();
+ switch (rData.GetOperation())
{
- ScAddress aPos = pData->GetPos();
- ScDetectiveFunc aFunc( &rDoc, aPos.Tab() );
- SCCOL nCol = aPos.Col();
- SCROW nRow = aPos.Row();
- switch (pData->GetOperation())
- {
- case SCDETOP_ADDSUCC:
- aFunc.ShowSucc( nCol, nRow );
- break;
- case SCDETOP_DELSUCC:
- aFunc.DeleteSucc( nCol, nRow );
- break;
- case SCDETOP_ADDPRED:
- aFunc.ShowPred( nCol, nRow );
- break;
- case SCDETOP_DELPRED:
- aFunc.DeletePred( nCol, nRow );
- break;
- case SCDETOP_ADDERROR:
- aFunc.ShowError( nCol, nRow );
- break;
- default:
- OSL_FAIL("falsche Op bei DetectiveRefresh");
- }
+ case SCDETOP_ADDSUCC:
+ aFunc.ShowSucc( nCol, nRow );
+ break;
+ case SCDETOP_DELSUCC:
+ aFunc.DeleteSucc( nCol, nRow );
+ break;
+ case SCDETOP_ADDPRED:
+ aFunc.ShowPred( nCol, nRow );
+ break;
+ case SCDETOP_DELPRED:
+ aFunc.DeletePred( nCol, nRow );
+ break;
+ case SCDETOP_ADDERROR:
+ aFunc.ShowError( nCol, nRow );
+ break;
+ default:
+ OSL_FAIL("falsche Op bei DetectiveRefresh");
}
}
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 93a1bd240409..f0b5d3a41241 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -345,9 +345,9 @@ void ScDocShell::AfterXMLLoading(bool bRet)
size_t nDPCount = pDPCollection->GetCount();
for (size_t nDP=0; nDP<nDPCount; ++nDP)
{
- ScDPObject* pDPObj = (*pDPCollection)[nDP];
- if (pDPObj->GetName().isEmpty())
- pDPObj->SetName( pDPCollection->CreateNewName() );
+ ScDPObject& rDPObj = (*pDPCollection)[nDP];
+ if (rDPObj.GetName().isEmpty())
+ rDPObj.SetName( pDPCollection->CreateNewName() );
}
}
}
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 8ef2a76112f9..9e245b6723be 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -437,13 +437,11 @@ void ScDocShell::RefreshPivotTables( const ScRange& rSource )
ScDBDocFunc aFunc(*this);
for (size_t i = 0, n = pColl->GetCount(); i < n; ++i)
{
- ScDPObject* pOld = (*pColl)[i];
- if (!pOld)
- continue;
+ ScDPObject& rOld = (*pColl)[i];
- const ScSheetSourceDesc* pSheetDesc = pOld->GetSheetDesc();
+ const ScSheetSourceDesc* pSheetDesc = rOld.GetSheetDesc();
if (pSheetDesc && pSheetDesc->GetSourceRange().Intersects(rSource))
- aFunc.UpdatePivotTable(*pOld, true, false);
+ aFunc.UpdatePivotTable(rOld, true, false);
}
}
diff --git a/sc/source/ui/inc/PivotLayoutDialog.hxx b/sc/source/ui/inc/PivotLayoutDialog.hxx
index 765990615a98..2449d65b1047 100644
--- a/sc/source/ui/inc/PivotLayoutDialog.hxx
+++ b/sc/source/ui/inc/PivotLayoutDialog.hxx
@@ -128,7 +128,7 @@ public:
ScItemValue* GetItem(SCCOL nColumn);
bool IsDataElement(SCCOL nColumn);
- ScDPLabelData* GetLabelData(SCCOL nColumn);
+ ScDPLabelData& GetLabelData(SCCOL nColumn);
ScDPLabelDataVector& GetLabelDataVector() { return maPivotParameters.maLabelArray;}
void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames);
};
diff --git a/sc/source/ui/inc/areasave.hxx b/sc/source/ui/inc/areasave.hxx
index 7448b7aa6560..6ea8b390a69a 100644
--- a/sc/source/ui/inc/areasave.hxx
+++ b/sc/source/ui/inc/areasave.hxx
@@ -64,8 +64,8 @@ public:
// returns NULL if empty
static ScAreaLinkSaveCollection* CreateFromDoc( const ScDocument* pDoc );
- ScAreaLinkSaver* operator[](size_t nIndex);
- const ScAreaLinkSaver* operator[](size_t nIndex) const;
+ ScAreaLinkSaver& operator[](size_t nIndex);
+ const ScAreaLinkSaver& operator[](size_t nIndex) const;
size_t size() const;
void push_back(ScAreaLinkSaver* p);
};
diff --git a/sc/source/ui/inc/rfindlst.hxx b/sc/source/ui/inc/rfindlst.hxx
index 80aaecfbd4ee..1db0c3a51d0e 100644
--- a/sc/source/ui/inc/rfindlst.hxx
+++ b/sc/source/ui/inc/rfindlst.hxx
@@ -44,20 +44,20 @@ class ScRangeFindList
sal_uInt16 nIndexColor;
public:
- ScRangeFindList(const OUString& rName);
+ ScRangeFindList(const OUString& rName);
- sal_uLong Count() const { return maEntries.size(); }
- ColorData Insert( const ScRangeFindData &rNew );
+ sal_uLong Count() const { return maEntries.size(); }
+ ColorData Insert( const ScRangeFindData &rNew );
- ScRangeFindData* GetObject( sal_uLong nIndex ) { return &(maEntries[nIndex]); }
+ ScRangeFindData& GetObject( sal_uLong nIndex ) { return maEntries[nIndex]; }
- void SetHidden( bool bSet ) { bHidden = bSet; }
+ void SetHidden( bool bSet ) { bHidden = bSet; }
- const OUString& GetDocName() const { return aDocName; }
- bool IsHidden() const { return bHidden; }
+ const OUString& GetDocName() const { return aDocName; }
+ bool IsHidden() const { return bHidden; }
static ColorData GetColorName(const size_t nIndex);
- ColorData FindColor(const ScRange& rRef, const size_t nIndex);
+ ColorData FindColor(const ScRange& rRef, const size_t nIndex);
};
#endif
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx
index 4c38e68a9948..579c08c6055a 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -190,8 +190,8 @@ const uno::Sequence<beans::PropertyValue>& ScSolverOptionsDialog::GetProperties(
sal_uInt16 nItemCount = pEntry->ItemCount();
for (sal_uInt16 nItemPos=0; nItemPos<nItemCount && !bHasData; ++nItemPos)
{
- SvLBoxItem* pItem = pEntry->GetItem( nItemPos );
- ScSolverOptionsString* pStringItem = dynamic_cast<ScSolverOptionsString*>(pItem);
+ SvLBoxItem& rItem = pEntry->GetItem( nItemPos );
+ ScSolverOptionsString* pStringItem = dynamic_cast<ScSolverOptionsString*>(&rItem);
if ( pStringItem )
{
if ( pStringItem->IsDouble() )
@@ -313,8 +313,8 @@ void ScSolverOptionsDialog::EditOption()
sal_uInt16 nItemCount = pEntry->ItemCount();
for (sal_uInt16 nPos=0; nPos<nItemCount; ++nPos)
{
- SvLBoxItem* pItem = pEntry->GetItem( nPos );
- ScSolverOptionsString* pStringItem = dynamic_cast<ScSolverOptionsString*>(pItem);
+ SvLBoxItem& rItem = pEntry->GetItem( nPos );
+ ScSolverOptionsString* pStringItem = dynamic_cast<ScSolverOptionsString*>(&rItem);
if ( pStringItem )
{
if ( pStringItem->IsDouble() )
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 571dfd63a8bb..c8d8a0fa184f 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1680,8 +1680,8 @@ void ScContentTree::InitEntry(SvTreeListEntry* pEntry,
{
sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2"
SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
- SvLBoxString* pCol = static_cast<SvLBoxString*>(pEntry->GetItem( nColToHilite ));
- SvLBoxString* pStr = new SvLBoxString( pEntry, 0, pCol->GetText() );
+ SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite ));
+ SvLBoxString* pStr = new SvLBoxString( pEntry, 0, rCol.GetText() );
pEntry->ReplaceItem( pStr, nColToHilite );
}
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 2b82a92bb0d8..0a4b8af15792 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -161,11 +161,9 @@ void ScCalcOptionsDialog::SelectedDeviceChanged()
mpFtMemory->SetText(OUString());
}
- SvLBoxString* pBoxEntry = dynamic_cast<SvLBoxString*>(pEntry->GetItem(1));
- if (!pBoxEntry)
- return;
+ SvLBoxString& rBoxEntry = dynamic_cast<SvLBoxString&>(pEntry->GetItem(1));
- OUString aDevice = pBoxEntry->GetText();
+ OUString aDevice = rBoxEntry.GetText();
// use english string for configuration
if(aDevice == maSoftware)
aDevice = OPENCL_SOFTWARE_DEVICE_CONFIG_NAME;
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index d172fb911854..c2668e43cfa1 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -266,7 +266,7 @@ size_t ScTpUserLists::UpdateUserListBox()
for ( size_t i=0; i<nCount; ++i )
{
- aEntry = (*pUserLists)[i]->GetString();
+ aEntry = (*pUserLists)[i].GetString();
OSL_ENSURE( !aEntry.isEmpty(), "Empty UserList-entry :-/" );
mpLbLists->InsertEntry( aEntry );
}
@@ -280,15 +280,15 @@ void ScTpUserLists::UpdateEntries( size_t nList )
if ( nList < pUserLists->size() )
{
- const ScUserListData* pList = (*pUserLists)[nList];
- std::size_t nSubCount = pList->GetSubCount();
+ const ScUserListData& rList = (*pUserLists)[nList];
+ std::size_t nSubCount = rList.GetSubCount();
OUString aEntryListStr;
for ( size_t i=0; i<nSubCount; i++ )
{
if ( i!=0 )
aEntryListStr += OUStringLiteral1<CR>();
- aEntryListStr += pList->GetSubStr(i);
+ aEntryListStr += rList.GetSubStr(i);
}
mpEdEntries->SetText(convertLineEnd(aEntryListStr, GetSystemLineEnd()));
@@ -442,7 +442,7 @@ void ScTpUserLists::ModifyList( size_t nSelList,
MakeListStr( theEntriesStr );
- (*pUserLists)[nSelList]->SetString( theEntriesStr );
+ (*pUserLists)[nSelList].SetString( theEntriesStr );
}
void ScTpUserLists::RemoveList( size_t nList )
diff --git a/sc/source/ui/undo/areasave.cxx b/sc/source/ui/undo/areasave.cxx
index 23f5881e4228..1fba078c212b 100644
--- a/sc/source/ui/undo/areasave.cxx
+++ b/sc/source/ui/undo/areasave.cxx
@@ -109,7 +109,7 @@ bool ScAreaLinkSaveCollection::IsEqual( const ScDocument* pDoc ) const
::sfx2::SvBaseLink* pBase = *rLinks[i];
if (pBase->ISA(ScAreaLink))
{
- if ( nPos >= size() || !(*this)[nPos]->IsEqual( *static_cast<ScAreaLink*>(pBase) ) )
+ if ( nPos >= size() || !(*this)[nPos].IsEqual( *static_cast<ScAreaLink*>(pBase) ) )
return false;
++nPos;
@@ -151,12 +151,12 @@ void ScAreaLinkSaveCollection::Restore( ScDocument* pDoc )
size_t nSaveCount = size();
for (size_t nPos=0; nPos<nSaveCount; ++nPos)
{
- ScAreaLinkSaver* pSaver = (*this)[nPos];
- ScAreaLink* pLink = lcl_FindLink( rLinks, *pSaver );
+ ScAreaLinkSaver& rSaver = (*this)[nPos];
+ ScAreaLink* pLink = lcl_FindLink( rLinks, rSaver );
if ( pLink )
- pSaver->WriteToLink( *pLink ); // restore output position
+ rSaver.WriteToLink( *pLink ); // restore output position
else
- pSaver->InsertNewLink( pDoc ); // re-insert deleted link
+ rSaver.InsertNewLink( pDoc ); // re-insert deleted link
}
}
}
@@ -187,14 +187,14 @@ ScAreaLinkSaveCollection* ScAreaLinkSaveCollection::CreateFromDoc( const ScDocum
return pColl;
}
-ScAreaLinkSaver* ScAreaLinkSaveCollection::operator [](size_t nIndex)
+ScAreaLinkSaver& ScAreaLinkSaveCollection::operator [](size_t nIndex)
{
- return &maData[nIndex];
+ return maData[nIndex];
}
-const ScAreaLinkSaver* ScAreaLinkSaveCollection::operator [](size_t nIndex) const
+const ScAreaLinkSaver& ScAreaLinkSaveCollection::operator [](size_t nIndex) const
{
- return &maData[nIndex];
+ return maData[nIndex];
}
size_t ScAreaLinkSaveCollection::size() const
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index bc4463e300e5..417a96e9f7d0 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -441,7 +441,7 @@ uno::Any SAL_CALL ScSpreadsheetSettings::getPropertyValue( const OUString& aProp
OUString* pAry = aSeq.getArray();
for (size_t i=0; i<nCount; ++i)
{
- OUString aEntry((*pUserList)[i]->GetString());
+ OUString aEntry((*pUserList)[i].GetString());
pAry[i] = aEntry;
}
aRet <<= aSeq;
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 44cb4d0bb51d..715cec1cacd5 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -241,10 +241,10 @@ static ScDPObject* lcl_GetDPObject( ScDocShell* pDocShell, SCTAB nTab, const OUS
size_t nCount = pColl->GetCount();
for (size_t i=0; i<nCount; ++i)
{
- ScDPObject* pDPObj = (*pColl)[i];
- if ( pDPObj->GetOutRange().aStart.Tab() == nTab &&
- pDPObj->GetName() == rName )
- return pDPObj;
+ ScDPObject& rDPObj = (*pColl)[i];
+ if ( rDPObj.GetOutRange().aStart.Tab() == nTab &&
+ rDPObj.GetName() == rName )
+ return &rDPObj;
}
}
}
@@ -321,12 +321,12 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nInd
size_t nCount = pColl->GetCount();
for (size_t i=0; i<nCount; ++i)
{
- ScDPObject* pDPObj = (*pColl)[i];
- if ( pDPObj->GetOutRange().aStart.Tab() == nTab )
+ ScDPObject& rDPObj = (*pColl)[i];
+ if ( rDPObj.GetOutRange().aStart.Tab() == nTab )
{
if ( nFound == nIndex )
{
- OUString aName = pDPObj->GetName();
+ OUString aName = rDPObj.GetName();
return new ScDataPilotTableObj( pDocShell, nTab, aName );
}
++nFound;
@@ -471,8 +471,8 @@ sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(RuntimeException, std:
size_t nCount = pColl->GetCount();
for (size_t i=0; i<nCount; ++i)
{
- ScDPObject* pDPObj = (*pColl)[i];
- if ( pDPObj->GetOutRange().aStart.Tab() == nTab )
+ ScDPObject& rDPObj = (*pColl)[i];
+ if ( rDPObj.GetOutRange().aStart.Tab() == nTab )
++nFound;
}
return nFound;
@@ -533,8 +533,8 @@ Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames()
size_t i;
for (i=0; i<nCount; ++i)
{
- ScDPObject* pDPObj = (*pColl)[i];
- if ( pDPObj->GetOutRange().aStart.Tab() == nTab )
+ ScDPObject& rDPObj = (*pColl)[i];
+ if ( rDPObj.GetOutRange().aStart.Tab() == nTab )
++nFound;
}
@@ -543,9 +543,9 @@ Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames()
OUString* pAry = aSeq.getArray();
for (i=0; i<nCount; ++i)
{
- ScDPObject* pDPObj = (*pColl)[i];
- if ( pDPObj->GetOutRange().aStart.Tab() == nTab )
- pAry[nPos++] = pDPObj->GetName();
+ ScDPObject& rDPObj = (*pColl)[i];
+ if ( rDPObj.GetOutRange().aStart.Tab() == nTab )
+ pAry[nPos++] = rDPObj.GetName();
}
return aSeq;
@@ -567,9 +567,9 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const OUString& aName )
size_t nCount = pColl->GetCount();
for (size_t i=0; i<nCount; ++i)
{
- ScDPObject* pDPObj = (*pColl)[i];
- if ( pDPObj->GetOutRange().aStart.Tab() == nTab &&
- pDPObj->GetName() == aName )
+ ScDPObject& rDPObj = (*pColl)[i];
+ if ( rDPObj.GetOutRange().aStart.Tab() == nTab &&
+ rDPObj.GetName() == aName )
return true;
}
}
@@ -2395,15 +2395,13 @@ DataPilotFieldGroupInfo ScDataPilotFieldObj::getGroupInfo()
ScFieldGroups aGroups;
for( sal_Int32 nIdx = 0, nCount = pGroupDim->GetGroupCount(); nIdx < nCount; ++nIdx )
{
- if( const ScDPSaveGroupItem* pGroup = pGroupDim->GetGroupByIndex( nIdx ) )
- {
- ScFieldGroup aGroup;
- aGroup.maName = pGroup->GetGroupName();
- for( sal_Int32 nMemIdx = 0, nMemCount = pGroup->GetElementCount(); nMemIdx < nMemCount; ++nMemIdx )
- if (const OUString* pMem = pGroup->GetElementByIndex(nMemIdx))
- aGroup.maMembers.push_back( *pMem );
- aGroups.push_back( aGroup );
- }
+ const ScDPSaveGroupItem& rGroup = pGroupDim->GetGroupByIndex( nIdx );
+ ScFieldGroup aGroup;
+ aGroup.maName = rGroup.GetGroupName();
+ for( sal_Int32 nMemIdx = 0, nMemCount = rGroup.GetElementCount(); nMemIdx < nMemCount; ++nMemIdx )
+ if (const OUString* pMem = rGroup.GetElementByIndex(nMemIdx))
+ aGroup.maMembers.push_back( *pMem );
+ aGroups.push_back( aGroup );
}
aInfo.Groups = new ScDataPilotFieldGroupsObj( aGroups );
}
@@ -2611,13 +2609,13 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons
long nGroupCount = pBaseGroupDim->GetGroupCount();
for ( long nGroup = 0; nGroup < nGroupCount; nGroup++ )
{
- const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup );
+ const ScDPSaveGroupItem& rBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup );
- if (!HasString(rItems, pBaseGroup->GetGroupName())) //! ignore case?
+ if (!HasString(rItems, rBaseGroup.GetGroupName())) //! ignore case?
{
// add an additional group for each item that is not in the selection
- ScDPSaveGroupItem aGroup( pBaseGroup->GetGroupName() );
- aGroup.AddElementsFromGroup( *pBaseGroup );
+ ScDPSaveGroupItem aGroup( rBaseGroup.GetGroupName() );
+ aGroup.AddElementsFromGroup( rBaseGroup );
pGroupDimension->AddGroupItem( aGroup );
}
}
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index bcb4c3546b0b..e80cdc9d611a 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -1133,13 +1133,13 @@ void ScDBFunc::GroupDataPilot()
long nGroupCount = pBaseGroupDim->GetGroupCount();
for ( long nGroup = 0; nGroup < nGroupCount; nGroup++ )
{
- const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup );
+ const ScDPSaveGroupItem& rBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup );
- if (!aEntries.count(pBaseGroup->GetGroupName()))
+ if (!aEntries.count(rBaseGroup.GetGroupName()))
{
// add an additional group for each item that is not in the selection
- ScDPSaveGroupItem aGroup( pBaseGroup->GetGroupName() );
- aGroup.AddElementsFromGroup( *pBaseGroup );
+ ScDPSaveGroupItem aGroup( rBaseGroup.GetGroupName() );
+ aGroup.AddElementsFromGroup( rBaseGroup );
pGroupDimension->AddGroupItem( aGroup );
}
}
@@ -1677,19 +1677,16 @@ bool ScDBFunc::DataPilotSort( const ScAddress& rPos, bool bAscending, sal_uInt16
return false;
}
- const ScUserListData* pData = (*pUserList)[*pUserListId];
- if (pData)
+ const ScUserListData& rData = (*pUserList)[*pUserListId];
+ sal_uInt16 n = rData.GetSubCount();
+ for (sal_uInt16 i = 0; i < n; ++i)
{
- sal_uInt16 n = pData->GetSubCount();
- for (sal_uInt16 i = 0; i < n; ++i)
- {
- OUString aSub = pData->GetSubStr(i);
- if (!aMemberSet.count(aSub))
- // This string doesn't exist in the member name set. Don't add this.
- continue;
+ OUString aSub = rData.GetSubStr(i);
+ if (!aMemberSet.count(aSub))
+ // This string doesn't exist in the member name set. Don't add this.
+ continue;
- aSubStrs.insert(UserSortMap::value_type(aSub, nSubCount++));
- }
+ aSubStrs.insert(UserSortMap::value_type(aSub, nSubCount++));
}
}
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 38dc2951b059..5acc912fa2af 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4952,22 +4952,22 @@ bool ScGridWindow::HitRangeFinder( const Point& rMouse, RfCorner& rCorner,
{
// search backwards so that the last repainted frame is found
--i;
- ScRangeFindData* pData = pRangeFinder->GetObject(i);
- if ( pData->aRef.In(aAddr) )
+ ScRangeFindData& rData = pRangeFinder->GetObject(i);
+ if ( rData.aRef.In(aAddr) )
{
if (pIndex)
*pIndex = i;
if (pAddX)
- *pAddX = nPosX - pData->aRef.aStart.Col();
+ *pAddX = nPosX - rData.aRef.aStart.Col();
if (pAddY)
- *pAddY = nPosY - pData->aRef.aStart.Row();
+ *pAddY = nPosY - rData.aRef.aStart.Row();
bFound = true;
rCorner = NONE;
- ScAddress aEnd = pData->aRef.aEnd;
- ScAddress aStart = pData->aRef.aStart;
+ ScAddress aEnd = rData.aRef.aEnd;
+ ScAddress aStart = rData.aRef.aStart;
if ( bCornerHorizontalLeft && bCornerVerticalUp &&
aAddr == aStart)
@@ -5145,7 +5145,7 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp )
ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList();
if (!pRangeFinder || nRFIndex >= pRangeFinder->Count())
return;
- ScRangeFindData* pData = pRangeFinder->GetObject( nRFIndex );
+ ScRangeFindData& rData = pRangeFinder->GetObject( nRFIndex );
// Mauszeiger
@@ -5203,7 +5203,7 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp )
SCsROW nPosY;
pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
- ScRange aOld = pData->aRef;
+ ScRange aOld = rData.aRef;
ScRange aNew = aOld;
if ( bRFSize )
{
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index cd7d66d88830..18b04a60635c 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -487,8 +487,8 @@ void ScGridWindow::DPLaunchFieldPopupMenu(
aUserSortNames.reserve(n);
for (size_t i = 0; i < n; ++i)
{
- const ScUserListData* pData = (*pUserList)[i];
- aUserSortNames.push_back(pData->GetString());
+ const ScUserListData& rData = (*pUserList)[i];
+ aUserSortNames.push_back(rData.GetString());
}
}
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 3523a620a56b..4357f52c46df 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -852,14 +852,14 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count();
for (sal_uInt16 i=0; i<nCount; i++)
{
- ScRangeFindData* pData = pRangeFinder->GetObject(i);
+ ScRangeFindData& rData = pRangeFinder->GetObject(i);
- ScRange aRef = pData->aRef;
+ ScRange aRef = rData.aRef;
aRef.Justify();
if ( aRef.aStart.Tab() >= nTab && aRef.aEnd.Tab() <= nTab )
aOutputData.DrawRefMark( aRef.aStart.Col(), aRef.aStart.Row(),
aRef.aEnd.Col(), aRef.aEnd.Row(),
- Color( pData->nColorData ),
+ Color( rData.nColorData ),
true );
}
}
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index ee300f42671f..3229f08d8446 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2100,13 +2100,13 @@ void ScTabView::PaintRangeFinder( long nNumber )
if (nNumber < 0)
{
for (sal_uInt16 i=0; i<nCount; i++)
- PaintRangeFinderEntry(pRangeFinder->GetObject(i),nTab);
+ PaintRangeFinderEntry(&pRangeFinder->GetObject(i),nTab);
}
else
{
sal_uInt16 idx = nNumber;
if (idx < nCount)
- PaintRangeFinderEntry(pRangeFinder->GetObject(idx),nTab);
+ PaintRangeFinderEntry(&pRangeFinder->GetObject(idx),nTab);
}
}
}