summaryrefslogtreecommitdiff
path: root/sc/source/ui
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/source/ui
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/source/ui')
-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
24 files changed, 144 insertions, 160 deletions
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);
}
}
}