diff options
author | Noel Grandin <noel@peralex.com> | 2014-06-18 12:14:29 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-06-24 11:34:21 +0200 |
commit | e2080e70fe8b085f18e868e46340454720fa94ca (patch) | |
tree | 4038d1d57b41b68a47d5ebbbe6ad390648ec6303 /sw/source/uibase | |
parent | Translated German comments - correction (diff) | |
download | core-e2080e70fe8b085f18e868e46340454720fa94ca.tar.gz core-e2080e70fe8b085f18e868e46340454720fa94ca.zip |
new compilerplugin returnbyref
Find places where we are returning a pointer to something, where we can
be returning a reference.
e.g.
class A {
struct X x;
public X* getX() { return &x; }
}
which can be:
public X& getX() { return x; }
Change-Id: I796fd23fd36a18aedf6e36bc28f8fab4f518c6c7
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/docvw/AnnotationWin.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/docvw/SidebarWin.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/docvw/frmsidebarwincontainer.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/inc/pview.hxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/inc/redlndlg.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/langhelper.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxvw.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/delete.cxx | 9 |
11 files changed, 33 insertions, 34 deletions
diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index a53cc29cd401..90a56323595b 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -545,8 +545,8 @@ void SwSpellDialogChildWindow::GetFocus() case SHELL_MODE_TABLE_LIST_TEXT: { SwPaM* pCursor = pWrtShell->GetCrsr(); - if(m_pSpellState->m_pPointNode != pCursor->GetNode(true) || - m_pSpellState->m_pMarkNode != pCursor->GetNode(false)|| + if(m_pSpellState->m_pPointNode != &pCursor->GetNode(true) || + m_pSpellState->m_pMarkNode != &pCursor->GetNode(false)|| m_pSpellState->m_nPointPos != pCursor->GetPoint()->nContent.GetIndex()|| m_pSpellState->m_nMarkPos != pCursor->GetMark()->nContent.GetIndex()) bInvalidate = true; @@ -602,8 +602,8 @@ void SwSpellDialogChildWindow::LoseFocus() { // store a node pointer and a pam-position to be able to check on next GetFocus(); SwPaM* pCursor = pWrtShell->GetCrsr(); - m_pSpellState->m_pPointNode = pCursor->GetNode(true); - m_pSpellState->m_pMarkNode = pCursor->GetNode(false); + m_pSpellState->m_pPointNode = &pCursor->GetNode(true); + m_pSpellState->m_pMarkNode = &pCursor->GetNode(false); m_pSpellState->m_nPointPos = pCursor->GetPoint()->nContent.GetIndex(); m_pSpellState->m_nMarkPos = pCursor->GetMark()->nContent.GetIndex(); diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index 9ef1e482bae0..1a0692146548 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -127,7 +127,7 @@ void SwAnnotationWin::UpdateData() { SwTxtFld *const pTxtFld = mpFmtFld->GetTxtFld(); SwPosition aPosition( pTxtFld->GetTxtNode() ); - aPosition.nContent = *pTxtFld->GetStart(); + aPosition.nContent = pTxtFld->GetStart(); rUndoRedo.AppendUndo( new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); } @@ -169,7 +169,7 @@ bool SwAnnotationWin::CalcFollow() { SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld(); SwPosition aPosition( pTxtFld->GetTxtNode() ); - aPosition.nContent = *pTxtFld->GetStart(); + aPosition.nContent = pTxtFld->GetStart(); SwTxtAttr * const pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt( aPosition.nContent.GetIndex() - 1, @@ -184,7 +184,7 @@ sal_uInt32 SwAnnotationWin::CountFollowing() sal_uInt32 aCount = 1; // we start with 1, so we have to subtract one at the end again SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld(); SwPosition aPosition( pTxtFld->GetTxtNode() ); - aPosition.nContent = *pTxtFld->GetStart(); + aPosition.nContent = pTxtFld->GetStart(); SwTxtAttr * pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt( aPosition.nContent.GetIndex() + 1, @@ -267,7 +267,7 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText) { SwTxtFld *const pTxtFld = mpFmtFld->GetTxtFld(); SwPosition aPosition( pTxtFld->GetTxtNode() ); - aPosition.nContent = *pTxtFld->GetStart(); + aPosition.nContent = pTxtFld->GetStart(); rUndoRedo.AppendUndo( new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); } diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx index 856d18c993d3..7f574601e827 100644 --- a/sw/source/uibase/docvw/SidebarWin.cxx +++ b/sw/source/uibase/docvw/SidebarWin.cxx @@ -660,7 +660,7 @@ void SwSidebarWin::SetPosAndSize() SwShellTableCrsr* pTableCrsr = new SwShellTableCrsr( DocView().GetWrtShell(), aStartPos ); pTableCrsr->SetMark(); pTableCrsr->GetMark()->nNode = *pTxtNode; - pTableCrsr->GetMark()->nContent.Assign( pTxtNode, *(pTxtAnnotationFld->GetStart())+1 ); + pTableCrsr->GetMark()->nContent.Assign( pTxtNode, pTxtAnnotationFld->GetStart()+1 ); pTableCrsr->NewTableSelection(); pTmpCrsr = pTableCrsr; } @@ -669,7 +669,7 @@ void SwSidebarWin::SetPosAndSize() SwShellCrsr* pCrsr = new SwShellCrsr( DocView().GetWrtShell(), aStartPos ); pCrsr->SetMark(); pCrsr->GetMark()->nNode = *pTxtNode; - pCrsr->GetMark()->nContent.Assign( pTxtNode, *(pTxtAnnotationFld->GetStart())+1 ); + pCrsr->GetMark()->nContent.Assign( pTxtNode, pTxtAnnotationFld->GetStart()+1 ); pTmpCrsr = pCrsr; } ::boost::scoped_ptr<SwShellCrsr> pTmpCrsrForAnnotationTextRange( pTmpCrsr ); diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 71e7f483c4be..e1fda396a3a2 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -3609,10 +3609,10 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) // half of the field was clicked on. SwTxtAttr const*const pTxtFld(aFieldAtPos.pFndTxtAttr); if (rSh.GetCurrentShellCursor().GetPoint()->nContent - .GetIndex() != *pTxtFld->GetStart()) + .GetIndex() != pTxtFld->GetStart()) { assert(rSh.GetCurrentShellCursor().GetPoint()->nContent - .GetIndex() == (*pTxtFld->GetStart() + 1)); + .GetIndex() == (pTxtFld->GetStart() + 1)); rSh.Left( CRSR_SKIP_CHARS, false, 1, false ); } // don't go into the !bOverSelect block below - it moves @@ -4507,7 +4507,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) // select content of Input Field, but exclude CH_TXT_ATR_INPUTFIELDSTART // and CH_TXT_ATR_INPUTFIELDEND rSh.SttSelect(); - rSh.SelectTxt( *(aCntntAtPos.pFndTxtAttr->GetStart()) + 1, + rSh.SelectTxt( aCntntAtPos.pFndTxtAttr->GetStart() + 1, *(aCntntAtPos.pFndTxtAttr->End()) - 1 ); } else diff --git a/sw/source/uibase/docvw/frmsidebarwincontainer.cxx b/sw/source/uibase/docvw/frmsidebarwincontainer.cxx index 3760f9778446..14c96d5da3a9 100644 --- a/sw/source/uibase/docvw/frmsidebarwincontainer.cxx +++ b/sw/source/uibase/docvw/frmsidebarwincontainer.cxx @@ -101,7 +101,7 @@ bool SwFrmSidebarWinContainer::insert( const SwFrm& rFrm, FrmKey aFrmKey( &rFrm ); SidebarWinContainer& rSidebarWinContainer = (*mpFrmSidebarWinContainer)[ aFrmKey ]; - SidebarWinKey aSidebarWinKey( *(rFmtFld.GetTxtFld()->GetStart()) ); + SidebarWinKey aSidebarWinKey( rFmtFld.GetTxtFld()->GetStart() ); if ( rSidebarWinContainer.empty() || rSidebarWinContainer.find( aSidebarWinKey) == rSidebarWinContainer.end() ) { diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx index 17676f2fff92..e3372fbf8239 100644 --- a/sw/source/uibase/inc/pview.hxx +++ b/sw/source/uibase/inc/pview.hxx @@ -225,8 +225,8 @@ private: static void InitInterface_Impl(); public: - inline Window* GetFrameWindow() const { return &(GetViewFrame())->GetWindow(); } - inline SwViewShell* GetViewShell() const { return pViewWin->GetViewShell(); } + inline Window& GetFrameWindow() const { return GetViewFrame()->GetWindow(); } + inline SwViewShell* GetViewShell() const { return pViewWin->GetViewShell(); } inline const Rectangle& GetVisArea() const { return aVisArea; } inline void GrabFocusViewWin() { pViewWin->GrabFocus(); } inline void RepaintCoreRect( const SwRect& rRect ) @@ -297,7 +297,7 @@ public: inline void SwPagePreview::AdjustEditWin() { - OuterResizePixel( Point(), GetFrameWindow()->GetOutputSizePixel() ); + OuterResizePixel( Point(), GetFrameWindow().GetOutputSizePixel() ); } #endif diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx index 1c3ca950a205..1a84a2a895fb 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -118,7 +118,7 @@ public: DECL_LINK( FilterChangedHdl, void *pDummy = 0 ); - inline SvxAcceptChgCtr* GetChgCtrl() { return &aTabPagesCTRL; } + inline SvxAcceptChgCtr& GetChgCtrl() { return aTabPagesCTRL; } inline bool HasRedlineAutoFmt() const { return bRedlnAutoFmt; } void Init(sal_uInt16 nStart = 0); diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx index 62474b422739..801a420471b5 100644 --- a/sw/source/uibase/shells/langhelper.cxx +++ b/sw/source/uibase/shells/langhelper.cxx @@ -546,7 +546,7 @@ namespace SwLangHelper // string for guessing language OUString aText; SwPaM *pCrsr = rSh.GetCrsr(); - SwTxtNode *pNode = pCrsr->GetNode()->GetTxtNode(); + SwTxtNode *pNode = pCrsr->GetNode().GetTxtNode(); if (pNode) { aText = pNode->GetTxt(); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index a10d2c68a24e..1ce5469bd189 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -839,11 +839,11 @@ SwUnoCrsr* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > pUnoCrsr->DeleteMark(); } } - const SwNode* pRangeNode = pUnoCrsr->GetNode(); - bParentInExtra = pRangeNode->FindFlyStartNode() || - pRangeNode->FindFootnoteStartNode() || - pRangeNode->FindHeaderStartNode() || - pRangeNode->FindFooterStartNode() ; + const SwNode& rRangeNode = pUnoCrsr->GetNode(); + bParentInExtra = rRangeNode.FindFlyStartNode() || + rRangeNode.FindFootnoteStartNode() || + rRangeNode.FindHeaderStartNode() || + rRangeNode.FindFooterStartNode() ; } util::SearchOptions aSearchOpt; diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index a21ae7536924..75d94dbab393 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -1105,20 +1105,20 @@ void SwXTextViewCursor::gotoRange( else if(nFrmType & FRMTYPE_FOOTNOTE) eSearchNodeType = SwFootnoteStartNode; - const SwStartNode* pOwnStartNode = aOwnPaM.GetNode()-> + const SwStartNode* pOwnStartNode = aOwnPaM.GetNode(). FindSttNodeByType(eSearchNodeType); const SwNode* pSrcNode = 0; if(pCursor && pCursor->GetPaM()) { - pSrcNode = pCursor->GetPaM()->GetNode(); + pSrcNode = &pCursor->GetPaM()->GetNode(); } else if (pRange) { SwPaM aPam(pRange->GetDoc()->GetNodes()); if (pRange->GetPositions(aPam)) { - pSrcNode = aPam.GetNode(); + pSrcNode = &aPam.GetNode(); } } else if (pPara && pPara->GetTxtNode()) @@ -1501,8 +1501,8 @@ void SwXTextViewCursor::setPropertyValue( const OUString& rPropertyName, const { SwWrtShell& rSh = m_pView->GetWrtShell(); SwPaM* pShellCrsr = rSh.GetCrsr(); - SwNode *pNode = pShellCrsr->GetNode(); - if (pNode && pNode->IsTxtNode()) + SwNode& rNode = pShellCrsr->GetNode(); + if (rNode.IsTxtNode()) { SwUnoCursorHelper::SetPropertyValue( *pShellCrsr, *m_pPropSet, rPropertyName, aValue ); diff --git a/sw/source/uibase/wrtsh/delete.cxx b/sw/source/uibase/wrtsh/delete.cxx index dcb9d4c52d0c..ae07f4b9c902 100644 --- a/sw/source/uibase/wrtsh/delete.cxx +++ b/sw/source/uibase/wrtsh/delete.cxx @@ -184,7 +184,7 @@ long SwWrtShell::DelLeft() // #i4032# Don't actually call a 'delete' if we // changed the table cell, compare DelRight(). const SwStartNode * pSNdOld = pWasInTblNd ? - GetSwCrsr()->GetNode()->FindTableBoxStartNode() : + GetSwCrsr()->GetNode().FindTableBoxStartNode() : 0; // If the cursor is at the beginning of a paragraph, try to step @@ -199,7 +199,7 @@ long SwWrtShell::DelLeft() return 0; const SwStartNode* pSNdNew = pIsInTblNd ? - GetSwCrsr()->GetNode()->FindTableBoxStartNode() : + GetSwCrsr()->GetNode().FindTableBoxStartNode() : 0; // #i4032# Don't actually call a 'delete' if we @@ -300,8 +300,7 @@ long SwWrtShell::DelRight() { // #108049# Save the startnode of the current cell const SwStartNode * pSNdOld; - pSNdOld = GetSwCrsr()->GetNode()-> - FindTableBoxStartNode(); + pSNdOld = GetSwCrsr()->GetNode().FindTableBoxStartNode(); if ( SwCrsrShell::IsEndPara() ) { @@ -320,7 +319,7 @@ long SwWrtShell::DelRight() cell. May be different to pSNdOld as we have moved. */ const SwStartNode * pSNdNew = GetSwCrsr() - ->GetNode()->FindTableBoxStartNode(); + ->GetNode().FindTableBoxStartNode(); /** #108049# Only move instead of deleting if we have moved to a different cell */ |