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 /sd | |
parent | f910280b8704ed9c289150a4ca3c8d60e15d0d97 (diff) |
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 'sd')
-rw-r--r-- | sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/accessibility/AccessibleOutlineView.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/app/sdmod2.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel4.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshell.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/func/fubullet.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/func/fuinsfil.cxx | 28 | ||||
-rw-r--r-- | sd/source/ui/func/fupoor.cxx | 20 | ||||
-rw-r--r-- | sd/source/ui/inc/DrawViewShell.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/OutlineView.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopback.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvs2.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvsh.cxx | 149 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 5 |
17 files changed, 120 insertions, 134 deletions
diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx index 0dba41cc3d5b..374cb96a1fd9 100644 --- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx +++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx @@ -860,7 +860,7 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() sValue += OUString::number((sal_Int16)((sal_uInt16)((pDrViewSh->getCurrentPage()->GetPageNum()-1)>>1) + 1)) ; sName = ";total-pages:"; sValue += sName; - sValue += OUString::number(pDrViewSh->GetPageTabControl()->GetPageCount()) ; + sValue += OUString::number(pDrViewSh->GetPageTabControl().GetPageCount()) ; sValue += ";"; if(pDrViewSh->IsLayerModeActive() && pDrViewSh->GetLayerTabControl()) // #i87182# { diff --git a/sd/source/ui/accessibility/AccessibleOutlineView.cxx b/sd/source/ui/accessibility/AccessibleOutlineView.cxx index dddaeec8a3dc..1ee2d591bc55 100644 --- a/sd/source/ui/accessibility/AccessibleOutlineView.cxx +++ b/sd/source/ui/accessibility/AccessibleOutlineView.cxx @@ -79,14 +79,14 @@ AccessibleOutlineView::AccessibleOutlineView ( { OutlinerView* pOutlineView = static_cast< ::sd::OutlineView*>( pView)->GetViewByWindow( pSdWindow ); - SdrOutliner* pOutliner = + SdrOutliner& rOutliner = static_cast< ::sd::OutlineView*>(pView)->GetOutliner(); - if( pOutlineView && pOutliner ) + if( pOutlineView ) { SAL_WNODEPRECATED_DECLARATIONS_PUSH maTextHelper.SetEditSource( ::std::auto_ptr< SvxEditSource >( new AccessibleOutlineEditSource( - *pOutliner, *pView, *pOutlineView, *pSdWindow ) ) ); + rOutliner, *pView, *pOutlineView, *pSdWindow ) ) ); SAL_WNODEPRECATED_DECLARATIONS_POP } } diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index b26d86a26e69..407132f4a369 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -91,17 +91,17 @@ static SdPage* GetCurrentPage( sd::ViewShell* pViewSh, EditFieldInfo* pInfo, boo if( pViewSh && pViewSh->ISA(sd::OutlineViewShell)) pSdView = static_cast<sd::OutlineView*> (static_cast<sd::OutlineViewShell*>(pViewSh)->GetView()); - if (pSdView != NULL && (pOutliner == pSdView->GetOutliner())) + if (pSdView != NULL && (pOutliner == &pSdView->GetOutliner())) { // outline mode int nPgNum = 0; - Outliner* pOutl = pSdView->GetOutliner(); + Outliner& rOutl = pSdView->GetOutliner(); long nPos = pInfo->GetPara(); sal_Int32 nParaPos = 0; - for( Paragraph* pPara = pOutl->GetParagraph( 0 ); pPara && nPos >= 0; pPara = pOutl->GetParagraph( ++nParaPos ), nPos-- ) + for( Paragraph* pPara = rOutl.GetParagraph( 0 ); pPara && nPos >= 0; pPara = rOutl.GetParagraph( ++nParaPos ), nPos-- ) { - if( pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) + if( rOutl.HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) nPgNum++; } diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index e5c5273b0ce2..e5892ae95e8b 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -622,7 +622,7 @@ bool DrawDocShell::SaveCompleted( const ::com::sun::star::uno::Reference< ::com: { if( mpViewShell->ISA( OutlineViewShell ) ) static_cast<OutlineView*>(mpViewShell->GetView()) - ->GetOutliner()->ClearModifyFlag(); + ->GetOutliner().ClearModifyFlag(); SdrOutliner* pOutl = mpViewShell->GetView()->GetTextEditOutliner(); if( pOutl ) diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 75665fa8763d..bb8d48f9e181 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -456,9 +456,7 @@ void DrawDocShell::ClearUndoBuffer() sd::OutlineView* pOutlView = dynamic_cast< sd::OutlineView* >( pView ); if( pOutlView ) { - SdrOutliner* pOutliner = pOutlView->GetOutliner(); - if( pOutliner ) - pOutliner->GetUndoManager().Clear(); + pOutlView->GetOutliner().GetUndoManager().Clear(); } } } diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx index d2359f9952f1..54c4f87a4e45 100644 --- a/sd/source/ui/func/fubullet.cxx +++ b/sd/source/ui/func/fubullet.cxx @@ -112,7 +112,7 @@ void FuBullet::InsertFormattingMark( sal_Unicode cMark ) } else if (mpViewShell->ISA(OutlineViewShell)) { - pOL = static_cast<OutlineView*>(mpView)->GetOutliner(); + pOL = &static_cast<OutlineView*>(mpView)->GetOutliner(); pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow( mpViewShell->GetActiveWindow()); } @@ -234,7 +234,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest& rReq ) } else if(mpViewShell && mpViewShell->ISA(OutlineViewShell)) { - pOL = static_cast<OutlineView*>(mpView)->GetOutliner(); + pOL = &static_cast<OutlineView*>(mpView)->GetOutliner(); pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow( mpViewShell->GetActiveWindow()); } diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 6ba1ebeffd5e..7074a9a5f596 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -559,28 +559,28 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) else if( aFilterName.indexOf( "HTML" ) != -1 ) nFormat = EE_FORMAT_HTML; - ::Outliner* pDocliner = static_cast<OutlineView*>(mpView)->GetOutliner(); + ::Outliner& rDocliner = static_cast<OutlineView*>(mpView)->GetOutliner(); std::vector<Paragraph*> aSelList; - pDocliner->GetView(0)->CreateSelectionList(aSelList); + rDocliner.GetView(0)->CreateSelectionList(aSelList); Paragraph* pPara = aSelList.empty() ? NULL : *(aSelList.begin()); // what should we insert? - while (pPara && !pDocliner->HasParaFlag(pPara, PARAFLAG_ISPAGE)) - pPara = pDocliner->GetParent(pPara); + while (pPara && !rDocliner.HasParaFlag(pPara, PARAFLAG_ISPAGE)) + pPara = rDocliner.GetParent(pPara); - sal_Int32 nTargetPos = pDocliner->GetAbsPos(pPara) + 1; + sal_Int32 nTargetPos = rDocliner.GetAbsPos(pPara) + 1; // apply layout of predecessor page sal_uInt16 nPage = 0; - pPara = pDocliner->GetParagraph( pDocliner->GetAbsPos( pPara ) - 1 ); + pPara = rDocliner.GetParagraph( rDocliner.GetAbsPos( pPara ) - 1 ); while (pPara) { - sal_Int32 nPos = pDocliner->GetAbsPos( pPara ); - if ( pDocliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) + sal_Int32 nPos = rDocliner.GetAbsPos( pPara ); + if ( rDocliner.HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) nPage++; - pPara = pDocliner->GetParagraph( nPos - 1 ); + pPara = rDocliner.GetParagraph( nPos - 1 ); } SdPage* pPage = mpDoc->GetSdPage(nPage, PK_STANDARD); aLayoutName = pPage->GetLayoutName(); @@ -636,7 +636,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) nNewPages = 0; - pDocliner->GetUndoManager().EnterListAction( + rDocliner.GetUndoManager().EnterListAction( SD_RESSTR(STR_UNDO_INSERT_FILE), OUString() ); sal_Int32 nSourcePos = 0; @@ -651,16 +651,16 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) if (nSourcePos < nParaCount - 1 || !pOutliner->GetText(pSourcePara).isEmpty()) { - pDocliner->Insert( pOutliner->GetText(pSourcePara), nTargetPos, nDepth ); + rDocliner.Insert( pOutliner->GetText(pSourcePara), nTargetPos, nDepth ); OUString aStyleSheetName( pStyleSheet->GetName() ); aStyleSheetName = aStyleSheetName.copy( 0, aStyleSheetName.getLength()-1 ); aStyleSheetName += OUString::number( nDepth <= 0 ? 1 : nDepth+1 ); SfxStyleSheetBasePool* pStylePool = mpDoc->GetStyleSheetPool(); SfxStyleSheet* pOutlStyle = (SfxStyleSheet*) pStylePool->Find( aStyleSheetName, pStyleSheet->GetFamily() ); - pDocliner->SetStyleSheet( nTargetPos, pOutlStyle ); + rDocliner.SetStyleSheet( nTargetPos, pOutlStyle ); } - if( pDocliner->HasParaFlag( pSourcePara, PARAFLAG_ISPAGE ) ) + if( rDocliner.HasParaFlag( pSourcePara, PARAFLAG_ISPAGE ) ) { nNewPages++; if( pProgress ) @@ -672,7 +672,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) nSourcePos++; } - pDocliner->GetUndoManager().LeaveListAction(); + rDocliner.GetUndoManager().LeaveListAction(); pProgress.reset(); diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx index 9d642e5949a7..11412a25e3c3 100644 --- a/sd/source/ui/func/fupoor.cxx +++ b/sd/source/ui/func/fupoor.cxx @@ -455,14 +455,14 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) // Switch the page and send events regarding // deactivation the old page and activating the new // one. - TabControl* pPageTabControl = + TabControl& rPageTabControl = static_cast<DrawViewShell*>(mpViewShell) ->GetPageTabControl(); - if (pPageTabControl->IsReallyShown()) - pPageTabControl->SendDeactivatePageEvent (); + if (rPageTabControl.IsReallyShown()) + rPageTabControl.SendDeactivatePageEvent (); static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(nSdPage - 1); - if (pPageTabControl->IsReallyShown()) - pPageTabControl->SendActivatePageEvent (); + if (rPageTabControl.IsReallyShown()) + rPageTabControl.SendActivatePageEvent (); } } else if (rKEvt.GetKeyCode().IsMod1()) @@ -501,13 +501,13 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) // Switch the page and send events regarding // deactivation the old page and activating the new // one. - TabControl* pPageTabControl = + TabControl& rPageTabControl = static_cast<DrawViewShell*>(mpViewShell)->GetPageTabControl(); - if (pPageTabControl->IsReallyShown()) - pPageTabControl->SendDeactivatePageEvent (); + if (rPageTabControl.IsReallyShown()) + rPageTabControl.SendDeactivatePageEvent (); static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(nSdPage + 1); - if (pPageTabControl->IsReallyShown()) - pPageTabControl->SendActivatePageEvent (); + if (rPageTabControl.IsReallyShown()) + rPageTabControl.SendActivatePageEvent (); } } else if (rKEvt.GetKeyCode().IsMod1()) diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index bf7462554f1f..c550e808234f 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -347,7 +347,7 @@ public: /** Return a pointer to the tab control for pages. */ - TabControl* GetPageTabControl (void) { return &maTabControl;} + TabControl& GetPageTabControl (void) { return maTabControl;} /** Return a pointer to the tab control for layers. */ diff --git a/sd/source/ui/inc/OutlineView.hxx b/sd/source/ui/inc/OutlineView.hxx index df312e82b1e8..21b29542e7ec 100644 --- a/sd/source/ui/inc/OutlineView.hxx +++ b/sd/source/ui/inc/OutlineView.hxx @@ -80,8 +80,8 @@ public: virtual void AddWindowToPaintView(OutputDevice* pWin) SAL_OVERRIDE; virtual void DeleteWindowFromPaintView(OutputDevice* pWin) SAL_OVERRIDE; - OutlinerView* GetViewByWindow (::Window* pWin) const; - SdrOutliner* GetOutliner() { return(&mrOutliner) ; } + OutlinerView* GetViewByWindow(::Window* pWin) const; + SdrOutliner& GetOutliner() { return mrOutliner; } Paragraph* GetPrevTitle(const Paragraph* pPara); Paragraph* GetNextTitle(const Paragraph* pPara); diff --git a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx index e7a14b8ee2f5..6e5c3bb196e8 100644 --- a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx @@ -208,7 +208,7 @@ void CurrentSlideManager::SetCurrentSlideAtViewShellBase (const SharedPageDescri { sal_uInt16 nPageNumber = (rpDescriptor->GetPage()->GetPageNum()-1)/2; pDrawViewShell->SwitchPage(nPageNumber); - pDrawViewShell->GetPageTabControl()->SetCurPageId(nPageNumber+1); + pDrawViewShell->GetPageTabControl().SetCurPageId(nPageNumber+1); } } } @@ -228,7 +228,7 @@ void CurrentSlideManager::SetCurrentSlideAtTabControl (const SharedPageDescripto if (pDrawViewShell) { sal_uInt16 nPageNumber = (rpDescriptor->GetPage()->GetPageNum()-1)/2; - pDrawViewShell->GetPageTabControl()->SetCurPageId(nPageNumber+1); + pDrawViewShell->GetPageTabControl().SetCurPageId(nPageNumber+1); } } } diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index c7dc1d787f1e..048d6fe1416e 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -2856,7 +2856,7 @@ void SdMasterPage::setBackground( const Any& rValue ) Reference< beans::XPropertySetInfo > xSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW ); Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY ); - PropertyEntryVector_t aBackgroundProperties = ImplGetPageBackgroundPropertySet()->getPropertyMap()->getPropertyEntries(); + PropertyEntryVector_t aBackgroundProperties = ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries(); PropertyEntryVector_t::const_iterator aIt = aBackgroundProperties.begin(); while( aIt != aBackgroundProperties.end() ) { diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx index 399d363f2c33..2c24a0fe3624 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -110,7 +110,7 @@ void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) if( mpPropSet->AreThereOwnUsrAnys() ) { uno::Any* pAny; - PropertyEntryVector_t aProperties = mpPropSet->getPropertyMap()->getPropertyEntries(); + PropertyEntryVector_t aProperties = mpPropSet->getPropertyMap().getPropertyEntries(); PropertyEntryVector_t::const_iterator aIt = aProperties.begin(); while( aIt != aProperties.end() ) @@ -445,7 +445,7 @@ uno::Any SAL_CALL SdUnoPageBackground::getPropertyDefault( const OUString& aProp /** this is used because our property map is not sorted yet */ const SfxItemPropertySimpleEntry* SdUnoPageBackground::getPropertyMapEntry( const OUString& rPropertyName ) const throw() { - return mpPropSet->getPropertyMap()->getByName(rPropertyName); + return mpPropSet->getPropertyMap().getByName(rPropertyName); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 35626c02c57b..2e7fb1938e1d 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -99,7 +99,7 @@ TextObjectBar::TextObjectBar ( OutlineView* pOutlinerView = dynamic_cast< OutlineView* >( mpView ); if( pOutlinerView ) { - SetUndoManager(&pOutlinerView->GetOutliner()->GetUndoManager()); + SetUndoManager(&pOutlinerView->GetOutliner().GetUndoManager()); } else { diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index 0f3812b72c1c..976d8a6a26ba 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -223,8 +223,8 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq) case SID_SELECTALL: { - ::Outliner* pOutl = pOlView->GetOutliner(); - sal_Int32 nParaCount = pOutl->GetParagraphCount(); + ::Outliner& rOutl = pOlView->GetOutliner(); + sal_Int32 nParaCount = rOutl.GetParagraphCount(); if (nParaCount > 0) { pOutlinerView->SelectRange( 0, nParaCount ); @@ -445,7 +445,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) { pOlView->SetSelectedPages(); SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) ); - pOlView->GetOutliner()->Clear(); + pOlView->GetOutliner().Clear(); pOlView->FillOutliner(); pOlView->GetActualPage(); Cancel(); @@ -456,7 +456,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) { pOlView->SetSelectedPages(); SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) ); - pOlView->GetOutliner()->Clear(); + pOlView->GetOutliner().Clear(); pOlView->FillOutliner(); pOlView->GetActualPage(); Cancel(); diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index b78fbfb1c67d..2cb952d56ad8 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -152,12 +152,12 @@ void OutlineViewShell::Construct(DrawDocShell* ) // Apply settings of FrameView ReadFrameViewData(mpFrameView); - ::Outliner* pOutl = pOlView->GetOutliner(); - pOutl->SetUpdateMode(true); + ::Outliner& rOutl = pOlView->GetOutliner(); + rOutl.SetUpdateMode(true); if (!bModified) { - pOutl->ClearModifyFlag(); + rOutl.ClearModifyFlag(); } pLastPage = GetActualPage(); @@ -296,7 +296,7 @@ void OutlineViewShell::ArrangeGUIElements () Rectangle aText = Rectangle(Point(0,0), Size(pOlView->GetPaperWidth(), - pOlView->GetOutliner()->GetTextHeight())); + pOlView->GetOutliner().GetTextHeight())); if (aWin.GetHeight() > aText.Bottom()) aText.Bottom() = aWin.GetHeight(); @@ -324,7 +324,7 @@ void OutlineViewShell::ExecCtrl(SfxRequest &rReq) case SID_OPT_LOCALE_CHANGED: { - pOlView->GetOutliner()->UpdateFields(); + pOlView->GetOutliner().UpdateFields(); UpdatePreview( GetActualPage() ); rReq.Done(); break; @@ -716,12 +716,9 @@ void OutlineViewShell::FuPermanent(SfxRequest &rReq) { case SID_EDIT_OUTLINER: { - ::Outliner* pOutl = pOlView->GetOutliner(); - if( pOutl ) - { - pOutl->GetUndoManager().Clear(); - pOutl->UpdateFields(); - } + ::Outliner& rOutl = pOlView->GetOutliner(); + rOutl.GetUndoManager().Clear(); + rOutl.UpdateFields(); SetCurrentFunction( FuOutlineText::Create(this,GetActiveWindow(),pOlView,GetDoc(),rReq) ); @@ -796,19 +793,16 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) rSet.DisableItem( SID_ZOOM_OUT ); } - ::Outliner* pOutl = pOlView->GetOutliner(); - DBG_ASSERT(pOutl, "OutlineViewShell::GetMenuState(), no outliner? Fatality!"); - if( !pOutl ) - return; + ::Outliner& rOutl = pOlView->GetOutliner(); // allow 'Select All'? if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SELECTALL ) ) { - sal_Int32 nParaCount = pOutl->GetParagraphCount(); + sal_Int32 nParaCount = rOutl.GetParagraphCount(); bool bDisable = nParaCount == 0; if (!bDisable && nParaCount == 1) { - OUString aTest = pOutl->GetText(pOutl->GetParagraph(0)); + OUString aTest = rOutl.GetText(rOutl.GetParagraph(0)); if (aTest.isEmpty()) { bDisable = true; @@ -822,14 +816,14 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) rSet.Put( SfxBoolItem( SID_RULER, HasRuler() ) ); // Enable formatting? - rSet.Put( SfxBoolItem( SID_OUTLINE_FORMAT, !pOutl->IsFlatMode() ) ); + rSet.Put( SfxBoolItem( SID_OUTLINE_FORMAT, !rOutl.IsFlatMode() ) ); - if( pOutl->IsFlatMode() ) + if( rOutl.IsFlatMode() ) rSet.DisableItem( SID_COLORVIEW ); else { // Enable color view? - sal_uLong nCntrl = pOutl->GetControlWord(); + sal_uLong nCntrl = rOutl.GetControlWord(); bool bNoColor = false; if (nCntrl & EE_CNTRL_NOCOLORS) bNoColor = true; @@ -853,21 +847,21 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) Paragraph* pPara = *iter; sal_Int16 nDepth; - sal_Int16 nTmpDepth = pOutl->GetDepth( pOutl->GetAbsPos( pPara ) ); - bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ); + sal_Int16 nTmpDepth = rOutl.GetDepth( rOutl.GetAbsPos( pPara ) ); + bool bPage = rOutl.HasParaFlag( pPara, PARAFLAG_ISPAGE ); while (iter != aSelList.begin()) { pPara = *iter; - nDepth = pOutl->GetDepth( pOutl->GetAbsPos( pPara ) ); + nDepth = rOutl.GetDepth( rOutl.GetAbsPos( pPara ) ); - if( nDepth != nTmpDepth || bPage != pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE )) + if( nDepth != nTmpDepth || bPage != rOutl.HasParaFlag( pPara, PARAFLAG_ISPAGE )) bUnique = false; - if (pOutl->HasChildren(pPara)) + if (rOutl.HasChildren(pPara)) { - if (!pOutl->IsExpanded(pPara)) + if (!rOutl.IsExpanded(pPara)) bDisableExpand = false; else bDisableCollapse = false; @@ -910,16 +904,16 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) if (bDisableCollapseAll || bDisableExpandAll) { sal_Int32 nParaPos = 0; - Paragraph* pPara = pOutl->GetParagraph( nParaPos ); + Paragraph* pPara = rOutl.GetParagraph( nParaPos ); while (pPara && (bDisableCollapseAll || bDisableExpandAll)) { - if (!pOutl->IsExpanded(pPara) && pOutl->HasChildren(pPara)) + if (!rOutl.IsExpanded(pPara) && rOutl.HasChildren(pPara)) bDisableExpandAll = false; - if (pOutl->IsExpanded(pPara) && pOutl->HasChildren(pPara)) + if (rOutl.IsExpanded(pPara) && rOutl.HasChildren(pPara)) bDisableCollapseAll = false; - pPara = pOutl->GetParagraph( ++nParaPos ); + pPara = rOutl.GetParagraph( ++nParaPos ); } } @@ -957,7 +951,7 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) rSet.DisableItem(SID_COPY); } - if (pOlView->GetOutliner()->IsModified()) + if (pOlView->GetOutliner().IsModified()) { GetDoc()->SetChanged(true); } @@ -1151,7 +1145,7 @@ long OutlineViewShell::VirtVScrollHdl(ScrollBar* pVScroll) OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWin); long nViewHeight = pWin->PixelToLogic( pWin->GetSizePixel()).Height(); - long nTextHeight = pOlView->GetOutliner()->GetTextHeight(); + long nTextHeight = pOlView->GetOutliner().GetTextHeight(); nViewHeight += nTextHeight; long nCurrentPos = pOutlinerView->GetVisArea().Top(); long nTargetPos = (long)(fY * nViewHeight); @@ -1275,16 +1269,16 @@ void OutlineViewShell::Execute(SfxRequest& rReq) */ void OutlineViewShell::ReadFrameViewData(FrameView* pView) { - ::Outliner* pOutl = pOlView->GetOutliner(); + ::Outliner& rOutl = pOlView->GetOutliner(); - pOutl->SetFlatMode( pView->IsNoAttribs() ); + rOutl.SetFlatMode( pView->IsNoAttribs() ); - sal_uLong nCntrl = pOutl->GetControlWord(); + sal_uLong nCntrl = rOutl.GetControlWord(); if ( pView->IsNoColors() ) - pOutl->SetControlWord(nCntrl | EE_CNTRL_NOCOLORS); + rOutl.SetControlWord(nCntrl | EE_CNTRL_NOCOLORS); else - pOutl->SetControlWord(nCntrl & ~EE_CNTRL_NOCOLORS); + rOutl.SetControlWord(nCntrl & ~EE_CNTRL_NOCOLORS); sal_uInt16 nPage = mpFrameView->GetSelectedPage(); pLastPage = GetDoc()->GetSdPage( nPage, PK_STANDARD ); @@ -1298,14 +1292,14 @@ void OutlineViewShell::ReadFrameViewData(FrameView* pView) */ void OutlineViewShell::WriteFrameViewData() { - ::Outliner* pOutl = pOlView->GetOutliner(); + ::Outliner& rOutl = pOlView->GetOutliner(); - sal_uLong nCntrl = pOutl->GetControlWord(); + sal_uLong nCntrl = rOutl.GetControlWord(); bool bNoColor = false; if (nCntrl & EE_CNTRL_NOCOLORS) bNoColor = true; mpFrameView->SetNoColors(bNoColor); - mpFrameView->SetNoAttribs( pOutl->IsFlatMode() ); + mpFrameView->SetNoAttribs( rOutl.IsFlatMode() ); SdPage* pActualPage = pOlView->GetActualPage(); DBG_ASSERT(pActualPage, "No current page"); if( pActualPage ) @@ -1361,9 +1355,9 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet) sal_uInt16 nPageCount = GetDoc()->GetSdPageCount( PK_STANDARD ); OUString aPageStr, aLayoutStr; - ::sd::Window* pWin = GetActiveWindow(); + ::sd::Window* pWin = GetActiveWindow(); OutlinerView* pActiveView = pOlView->GetViewByWindow( pWin ); - ::Outliner* pOutliner = pOlView->GetOutliner(); + ::Outliner& rOutliner = pOlView->GetOutliner(); std::vector<Paragraph*> aSelList; pActiveView->CreateSelectionList(aSelList); @@ -1377,10 +1371,10 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet) pLastPara = *(aSelList.rbegin()); } - if( !pOutliner->HasParaFlag(pFirstPara,PARAFLAG_ISPAGE) ) + if( !rOutliner.HasParaFlag(pFirstPara,PARAFLAG_ISPAGE) ) pFirstPara = pOlView->GetPrevTitle( pFirstPara ); - if( !pOutliner->HasParaFlag(pLastPara, PARAFLAG_ISPAGE) ) + if( !rOutliner.HasParaFlag(pLastPara, PARAFLAG_ISPAGE) ) pLastPara = pOlView->GetPrevTitle( pLastPara ); // only one page selected? @@ -1499,24 +1493,21 @@ bool OutlineViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) OUString OutlineViewShell::GetSelectionText(bool bCompleteWords) { OUString aStrSelection; - ::Outliner* pOl = pOlView->GetOutliner(); + ::Outliner& rOl = pOlView->GetOutliner(); OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() ); - if (pOl) + if (bCompleteWords) { - if (bCompleteWords) - { - ESelection aSel = pOutlinerView->GetSelection(); - OUString aStrCurrentDelimiters = pOl->GetWordDelimiters(); + ESelection aSel = pOutlinerView->GetSelection(); + OUString aStrCurrentDelimiters = rOl.GetWordDelimiters(); - pOl->SetWordDelimiters(" .,;\"'"); - aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos ); - pOl->SetWordDelimiters( aStrCurrentDelimiters ); - } - else - { - aStrSelection = pOutlinerView->GetSelected(); - } + rOl.SetWordDelimiters(" .,;\"'"); + aStrSelection = rOl.GetWord( aSel.nEndPara, aSel.nEndPos ); + rOl.SetWordDelimiters( aStrCurrentDelimiters ); + } + else + { + aStrSelection = pOutlinerView->GetSelected(); } return (aStrSelection); @@ -1705,11 +1696,11 @@ bool OutlineViewShell::UpdateTitleObject( SdPage* pPage, Paragraph* pPara ) if( !pPage || !pPara ) return false; - ::Outliner* pOutliner = pOlView->GetOutliner(); + ::Outliner& rOutliner = pOlView->GetOutliner(); SdrTextObj* pTO = pOlView->GetTitleTextObject( pPage ); OutlinerParaObject* pOPO = NULL; - OUString aTest = pOutliner->GetText(pPara); + OUString aTest = rOutliner.GetText(pPara); bool bText = !aTest.isEmpty(); bool bNewObject = false; @@ -1726,7 +1717,7 @@ bool OutlineViewShell::UpdateTitleObject( SdPage* pPage, Paragraph* pPara ) // if we have a title object and a text, set the text if( pTO ) { - pOPO = pOutliner->CreateParaObject( pOutliner->GetAbsPos( pPara ), 1 ); + pOPO = rOutliner.CreateParaObject( rOutliner.GetAbsPos( pPara ), 1 ); pOPO->SetOutlinerMode( OUTLINERMODE_TITLEOBJECT ); pOPO->SetVertical( pTO->IsVerticalWriting() ); if( pTO->GetOutlinerParaObject() && (pOPO->GetTextObject() == pTO->GetOutlinerParaObject()->GetTextObject()) ) @@ -1787,7 +1778,7 @@ bool OutlineViewShell::UpdateOutlineObject( SdPage* pPage, Paragraph* pPara ) if( !pPage || !pPara ) return false; - ::Outliner* pOutliner = pOlView->GetOutliner(); + ::Outliner& rOutliner = pOlView->GetOutliner(); OutlinerParaObject* pOPO = NULL; SdrTextObj* pTO = NULL; @@ -1802,19 +1793,19 @@ bool OutlineViewShell::UpdateOutlineObject( SdPage* pPage, Paragraph* pPara ) } // how many paragraphs in the outline? - sal_Int32 nTitlePara = pOutliner->GetAbsPos( pPara ); + sal_Int32 nTitlePara = rOutliner.GetAbsPos( pPara ); sal_Int32 nPara = nTitlePara + 1; sal_Int32 nParasInLayout = 0L; - pPara = pOutliner->GetParagraph( nPara ); - while( pPara && !pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) + pPara = rOutliner.GetParagraph( nPara ); + while( pPara && !rOutliner.HasParaFlag(pPara, PARAFLAG_ISPAGE) ) { nParasInLayout++; - pPara = pOutliner->GetParagraph( ++nPara ); + pPara = rOutliner.GetParagraph( ++nPara ); } if( nParasInLayout ) { // create an OutlinerParaObject - pOPO = pOutliner->CreateParaObject( nTitlePara + 1, nParasInLayout ); + pOPO = rOutliner.CreateParaObject( nTitlePara + 1, nParasInLayout ); } if( pOPO ) @@ -1892,41 +1883,40 @@ sal_uLong OutlineViewShell::Read(SvStream& rInput, const OUString& rBaseURL, sal { sal_uLong bRet = 0; - ::Outliner* pOutl = pOlView->GetOutliner(); + ::Outliner& rOutl = pOlView->GetOutliner(); - { OutlineViewPageChangesGuard aGuard( pOlView ); OutlineViewModelChangeGuard aGuard2( *pOlView ); - bRet = pOutl->Read( rInput, rBaseURL, eFormat, GetDocSh()->GetHeaderAttributes() ); + bRet = rOutl.Read( rInput, rBaseURL, eFormat, GetDocSh()->GetHeaderAttributes() ); SdPage* pPage = GetDoc()->GetSdPage( GetDoc()->GetSdPageCount(PK_STANDARD) - 1, PK_STANDARD );; SfxStyleSheet* pTitleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ); SfxStyleSheet* pOutlSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE ); - sal_Int32 nParaCount = pOutl->GetParagraphCount(); + sal_Int32 nParaCount = rOutl.GetParagraphCount(); if ( nParaCount > 0 ) { for ( sal_Int32 nPara = 0; nPara < nParaCount; nPara++ ) { pOlView->UpdateParagraph( nPara ); - sal_Int16 nDepth = pOutl->GetDepth( nPara ); + sal_Int16 nDepth = rOutl.GetDepth( nPara ); if( (nDepth == 0) || !nPara ) { - Paragraph* pPara = pOutl->GetParagraph( nPara ); - pOutl->SetDepth(pPara, -1); - pOutl->SetParaFlag(pPara, PARAFLAG_ISPAGE); + Paragraph* pPara = rOutl.GetParagraph( nPara ); + rOutl.SetDepth(pPara, -1); + rOutl.SetParaFlag(pPara, PARAFLAG_ISPAGE); - pOutl->SetStyleSheet( nPara, pTitleSheet ); + rOutl.SetStyleSheet( nPara, pTitleSheet ); if( nPara ) // first slide already exists pOlView->InsertSlideForParagraph( pPara ); } else { - pOutl->SetDepth( pOutl->GetParagraph( nPara ), nDepth - 1 ); + rOutl.SetDepth( rOutl.GetParagraph( nPara ), nDepth - 1 ); OUString aStyleSheetName = pOutlSheet->GetName(); if (!aStyleSheetName.isEmpty()) aStyleSheetName = aStyleSheetName.copy(0, aStyleSheetName.getLength() - 1); @@ -1935,13 +1925,12 @@ sal_uLong OutlineViewShell::Read(SvStream& rInput, const OUString& rBaseURL, sal SfxStyleSheet* pStyle = (SfxStyleSheet*) pStylePool->Find( aStyleSheetName, pOutlSheet->GetFamily() ); DBG_ASSERT( pStyle, "AutoStyleSheetName - Style not found!" ); if ( pStyle ) - pOutl->SetStyleSheet( nPara, pStyle ); + rOutl.SetStyleSheet( nPara, pStyle ); } } } - } - pOutl->GetUndoManager().Clear(); + rOutl.GetUndoManager().Clear(); return( bRet ); } diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 2ff4a712b1d1..11f710137d45 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -1067,9 +1067,8 @@ void ViewShell::UpdatePreview (SdPage*, bool ) OutlineView* pOlView = dynamic_cast< OutlineView* >( pView ); if( pOlView ) { - ::Outliner* pOutl = pOlView->GetOutliner(); - if( pOutl ) - return &pOutl->GetUndoManager(); + ::Outliner& rOutl = pOlView->GetOutliner(); + return &rOutl.GetUndoManager(); } } else if( pView->IsTextEdit() ) |