editeng/source/outliner/outlvw.cxx | 399 +++++++++---------- include/editeng/outliner.hxx | 10 sc/source/ui/drawfunc/drtxtob.cxx | 21 - sc/source/ui/view/gridwin.cxx | 6 sd/source/ui/annotations/annotationwindow.cxx | 2 sd/source/ui/func/fubullet.cxx | 2 sd/source/ui/func/fuinsfil.cxx | 44 +- sd/source/ui/func/fuprobjs.cxx | 6 sd/source/ui/view/NotesPanelView.cxx | 2 sd/source/ui/view/NotesPanelViewShell.cxx | 9 sd/source/ui/view/Outliner.cxx | 2 sd/source/ui/view/drawview.cxx | 14 sd/source/ui/view/drtxtob.cxx | 28 - sd/source/ui/view/drtxtob1.cxx | 95 ++-- sd/source/ui/view/drviews2.cxx | 5 sd/source/ui/view/drviews4.cxx | 7 sd/source/ui/view/drviews7.cxx | 6 sd/source/ui/view/outlnvs2.cxx | 17 sd/source/ui/view/outlnvsh.cxx | 4 sd/source/ui/view/outlview.cxx | 4 sd/source/ui/view/sdview.cxx | 2 sd/source/ui/view/sdview2.cxx | 41 - svx/source/svdraw/svdedxv.cxx | 56 +- sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 4 sw/source/uibase/docvw/AnnotationWin2.cxx | 2 sw/source/uibase/docvw/PostItMgr.cxx | 11 sw/source/uibase/docvw/SidebarTxtControl.cxx | 2 sw/source/uibase/lingu/sdrhhcwrap.cxx | 4 sw/source/uibase/shells/annotsh.cxx | 23 - sw/source/uibase/shells/drwtxtex.cxx | 2 sw/source/uibase/shells/drwtxtsh.cxx | 2 31 files changed, 401 insertions(+), 431 deletions(-)
New commits: commit b22592c2fad4677e7bed01b03ab0a6cc02489862 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon May 19 10:08:24 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon May 19 15:04:08 2025 +0200 OutlinerView always has an Outliner Change-Id: I73ea7d3224ace7f181aee75ae99d9c2897ac0819 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185518 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 3d9bf3c690ba..5ca0cec7d5f0 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -49,11 +49,10 @@ using namespace ::com::sun::star; - -OutlinerView::OutlinerView( Outliner* pOut, vcl::Window* pWin ) +OutlinerView::OutlinerView(Outliner& rOut, vcl::Window* pWin) + : rOwner(rOut) + , pEditView(new EditView(rOut.getOutlinerEditEng(), pWin)) { - pOwner = pOut; - pEditView.reset( new EditView( *pOut->pEditEngine, pWin ) ); } OutlinerView::~OutlinerView() @@ -64,8 +63,8 @@ void OutlinerView::Paint( const tools::Rectangle& rRect, OutputDevice* pTargetDe { // For the first Paint/KeyInput/Drop an empty Outliner is turned into // an Outliner with exactly one paragraph. - if( pOwner->bFirstParaIsEmpty ) - pOwner->Insert( OUString() ); + if( rOwner.bFirstParaIsEmpty ) + rOwner.Insert( OUString() ); pEditView->Paint( rRect, pTargetDevice ); } @@ -74,8 +73,8 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra { // For the first Paint/KeyInput/Drop an empty Outliner is turned into // an Outliner with exactly one paragraph. - if( pOwner->bFirstParaIsEmpty ) - pOwner->Insert( OUString() ); + if( rOwner.bFirstParaIsEmpty ) + rOwner.Insert( OUString() ); bool bKeyProcessed = false; ESelection aSel( pEditView->GetSelection() ); @@ -87,7 +86,7 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra if( bSelection && ( nCode != KEY_TAB ) && EditEngine::DoesKeyChangeText( rKEvt ) ) { - if ( ImpCalcSelectedPages( false ) && !pOwner->ImpCanDeleteSelectedPages( this ) ) + if ( ImpCalcSelectedPages( false ) && !rOwner.ImpCanDeleteSelectedPages( this ) ) return true; } @@ -121,14 +120,14 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra break; case KeyFuncType::DELETE: { - if( !bReadOnly && !bSelection && ( pOwner->GetOutlinerMode() != OutlinerMode::TextObject ) ) + if( !bReadOnly && !bSelection && ( rOwner.GetOutlinerMode() != OutlinerMode::TextObject ) ) { - if (aSel.end.nIndex == pOwner->pEditEngine->GetTextLen(aSel.end.nPara)) + if (aSel.end.nIndex == rOwner.pEditEngine->GetTextLen(aSel.end.nPara)) { - Paragraph* pNext = pOwner->pParaList->GetParagraph(aSel.end.nPara + 1); + Paragraph* pNext = rOwner.pParaList->GetParagraph(aSel.end.nPara + 1); if( pNext && pNext->HasFlag(ParaFlag::ISPAGE) ) { - if (!pOwner->ImpCanDeleteSelectedPages(this, aSel.end.nPara, 1)) + if (!rOwner.ImpCanDeleteSelectedPages(this, aSel.end.nPara, 1)) return false; } } @@ -147,15 +146,15 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra { if ( !bReadOnly && !aKeyCode.IsMod1() && !aKeyCode.IsMod2() ) { - if ( ( pOwner->GetOutlinerMode() != OutlinerMode::TextObject ) && - ( pOwner->GetOutlinerMode() != OutlinerMode::TitleObject ) && + if ( ( rOwner.GetOutlinerMode() != OutlinerMode::TextObject ) && + ( rOwner.GetOutlinerMode() != OutlinerMode::TitleObject ) && ( bSelection || !aSel.start.nIndex ) ) { Indent( aKeyCode.IsShift() ? -1 : +1 ); bKeyProcessed = true; } - else if ( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) && - !bSelection && !aSel.end.nIndex && pOwner->ImplHasNumberFormat( aSel.end.nPara ) ) + else if ( ( rOwner.GetOutlinerMode() == OutlinerMode::TextObject ) && + !bSelection && !aSel.end.nIndex && rOwner.ImplHasNumberFormat( aSel.end.nPara ) ) { Indent( aKeyCode.IsShift() ? -1 : +1 ); bKeyProcessed = true; @@ -167,13 +166,13 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra { if (!bReadOnly && !bSelection && aSel.end.nPara && !aSel.end.nIndex) { - Paragraph* pPara = pOwner->pParaList->GetParagraph(aSel.end.nPara); - Paragraph* pPrev = pOwner->pParaList->GetParagraph(aSel.end.nPara - 1); + Paragraph* pPara = rOwner.pParaList->GetParagraph(aSel.end.nPara); + Paragraph* pPrev = rOwner.pParaList->GetParagraph(aSel.end.nPara - 1); if( !pPrev->IsVisible() ) return true; if( !pPara->GetDepth() ) { - if (!pOwner->ImpCanDeleteSelectedPages(this, aSel.end.nPara, 1)) + if (!rOwner.ImpCanDeleteSelectedPages(this, aSel.end.nPara, 1)) return true; } } @@ -185,56 +184,56 @@ bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window const * pFra { // Special treatment: hard return at the end of a paragraph, // which has collapsed subparagraphs. - Paragraph* pPara = pOwner->pParaList->GetParagraph(aSel.end.nPara); + Paragraph* pPara = rOwner.pParaList->GetParagraph(aSel.end.nPara); if( !aKeyCode.IsShift() ) { // Don't let insert empty paragraph with numbering. Instead end numbering. if (pPara->GetDepth() > -1 && - pOwner->pEditEngine->GetTextLen( aSel.end.nPara ) == 0) + rOwner.pEditEngine->GetTextLen( aSel.end.nPara ) == 0) { ToggleBullets(); return true; } // ImpGetCursor again??? if( !bSelection && - aSel.end.nIndex == pOwner->pEditEngine->GetTextLen( aSel.end.nPara ) ) + aSel.end.nIndex == rOwner.pEditEngine->GetTextLen( aSel.end.nPara ) ) { - sal_Int32 nChildren = pOwner->pParaList->GetChildCount(pPara); - if( nChildren && !pOwner->pParaList->HasVisibleChildren(pPara)) + sal_Int32 nChildren = rOwner.pParaList->GetChildCount(pPara); + if( nChildren && !rOwner.pParaList->HasVisibleChildren(pPara)) { - pOwner->UndoActionStart( OLUNDO_INSERT ); + rOwner.UndoActionStart( OLUNDO_INSERT ); sal_Int32 nTemp = aSel.end.nPara; nTemp += nChildren; nTemp++; // insert above next Non-Child SAL_WARN_IF( nTemp < 0, "editeng", "OutlinerView::PostKeyEvent - overflow"); if (nTemp >= 0) { - pOwner->Insert( OUString(),nTemp,pPara->GetDepth()); + rOwner.Insert( OUString(),nTemp,pPara->GetDepth()); // Position the cursor ESelection aTmpSel(nTemp, 0); pEditView->SetSelection( aTmpSel ); } pEditView->ShowCursor(); - pOwner->UndoActionEnd(); + rOwner.UndoActionEnd(); bKeyProcessed = true; } } } if( !bKeyProcessed && !bSelection && !aKeyCode.IsShift() && aKeyCode.IsMod1() && - ( aSel.end.nIndex == pOwner->pEditEngine->GetTextLen(aSel.end.nPara) ) ) + ( aSel.end.nIndex == rOwner.pEditEngine->GetTextLen(aSel.end.nPara) ) ) { - pOwner->UndoActionStart( OLUNDO_INSERT ); + rOwner.UndoActionStart( OLUNDO_INSERT ); sal_Int32 nTemp = aSel.end.nPara; nTemp++; - pOwner->Insert( OUString(), nTemp, pPara->GetDepth()+1 ); + rOwner.Insert( OUString(), nTemp, pPara->GetDepth()+1 ); // Position the cursor ESelection aTmpSel(nTemp, 0); pEditView->SetSelection( aTmpSel ); pEditView->ShowCursor(); - pOwner->UndoActionEnd(); + rOwner.UndoActionEnd(); bKeyProcessed = true; } } @@ -268,10 +267,10 @@ sal_Int32 OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTa aPaperPos.AdjustY(aVisArea.Top() ); bool bBullet; - if ( pOwner->IsTextPos( aPaperPos, 0, &bBullet ) ) + if ( rOwner.IsTextPos( aPaperPos, 0, &bBullet ) ) { - Point aDocPos = pOwner->GetDocPos( aPaperPos ); - nPara = pOwner->pEditEngine->FindParagraph( aDocPos.Y() ); + Point aDocPos = rOwner.GetDocPos( aPaperPos ); + nPara = rOwner.pEditEngine->FindParagraph( aDocPos.Y() ); if ( bBullet ) { @@ -291,7 +290,7 @@ sal_Int32 OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTa bool OutlinerView::MouseMove( const MouseEvent& rMEvt ) { - if( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->getEditEngine().IsInSelectionMode()) + if( ( rOwner.GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->getEditEngine().IsInSelectionMode()) return pEditView->MouseMove( rMEvt ); Point aMousePosWin( pEditView->GetOutputDevice().PixelToLogic( rMEvt.GetPosPixel() ) ); @@ -306,7 +305,7 @@ bool OutlinerView::MouseMove( const MouseEvent& rMEvt ) bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) { - if ( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->getEditEngine().IsInSelectionMode() ) + if ( ( rOwner.GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->getEditEngine().IsInSelectionMode() ) return pEditView->MouseButtonDown( rMEvt ); Point aMousePosWin( pEditView->GetOutputDevice().PixelToLogic( rMEvt.GetPosPixel() ) ); @@ -320,13 +319,13 @@ bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) sal_Int32 nPara = ImpCheckMousePos( rMEvt.GetPosPixel(), eTarget ); if ( eTarget == MouseTarget::Bullet ) { - Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - bool bHasChildren = (pPara && pOwner->pParaList->HasChildren(pPara)); + Paragraph* pPara = rOwner.pParaList->GetParagraph( nPara ); + bool bHasChildren = (pPara && rOwner.pParaList->HasChildren(pPara)); if( rMEvt.GetClicks() == 1 ) { sal_Int32 nEndPara = nPara; - if ( bHasChildren && pOwner->pParaList->HasVisibleChildren(pPara) ) - nEndPara += pOwner->pParaList->GetChildCount( pPara ); + if ( bHasChildren && rOwner.pParaList->HasVisibleChildren(pPara) ) + nEndPara += rOwner.pParaList->GetChildCount( pPara ); // The selection is inverted, so that EditEngine does not scroll ESelection aSel(nEndPara, EE_TEXTPOS_MAX, nPara, 0); pEditView->SetSelection( aSel ); @@ -338,12 +337,12 @@ bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) } // special case for outliner view in impress, check if double click hits the page icon for toggle - if( (nPara == EE_PARA_MAX) && (pOwner->GetOutlinerMode() == OutlinerMode::OutlineView) && (eTarget == MouseTarget::Text) && (rMEvt.GetClicks() == 2) ) + if( (nPara == EE_PARA_MAX) && (rOwner.GetOutlinerMode() == OutlinerMode::OutlineView) && (eTarget == MouseTarget::Text) && (rMEvt.GetClicks() == 2) ) { ESelection aSel( pEditView->GetSelection() ); nPara = aSel.start.nPara; - Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - if( (pPara && pOwner->pParaList->HasChildren(pPara)) && pPara->HasFlag(ParaFlag::ISPAGE) ) + Paragraph* pPara = rOwner.pParaList->GetParagraph( nPara ); + if( (pPara && rOwner.pParaList->HasChildren(pPara)) && pPara->HasFlag(ParaFlag::ISPAGE) ) { ImpToggleExpand( pPara ); } @@ -354,7 +353,7 @@ bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt ) bool OutlinerView::MouseButtonUp( const MouseEvent& rMEvt ) { - if ( ( pOwner->GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->getEditEngine().IsInSelectionMode() ) + if ( ( rOwner.GetOutlinerMode() == OutlinerMode::TextObject ) || pEditView->getEditEngine().IsInSelectionMode() ) return pEditView->MouseButtonUp( rMEvt ); Point aMousePosWin( pEditView->GetOutputDevice().PixelToLogic( rMEvt.GetPosPixel() ) ); @@ -374,15 +373,15 @@ void OutlinerView::ReleaseMouse() void OutlinerView::ImpToggleExpand( Paragraph const * pPara ) { - sal_Int32 nPara = pOwner->pParaList->GetAbsPos( pPara ); + sal_Int32 nPara = rOwner.pParaList->GetAbsPos( pPara ); pEditView->SetSelection(ESelection(nPara, 0)); - ImplExpandOrCollaps( nPara, nPara, !pOwner->pParaList->HasVisibleChildren( pPara ) ); + ImplExpandOrCollaps( nPara, nPara, !rOwner.pParaList->HasVisibleChildren( pPara ) ); pEditView->ShowCursor(); } void OutlinerView::Select( Paragraph const * pParagraph, bool bSelect ) { - sal_Int32 nPara = pOwner->pParaList->GetAbsPos( pParagraph ); + sal_Int32 nPara = rOwner.pParaList->GetAbsPos( pParagraph ); sal_Int32 nEnd = 0; if ( bSelect ) nEnd = SAL_MAX_INT32; @@ -393,18 +392,18 @@ void OutlinerView::Select( Paragraph const * pParagraph, bool bSelect ) void OutlinerView::SetDepth(sal_Int32 nParagraph, sal_Int16 nDepth) { - Paragraph* pParagraph = pOwner->GetParagraph(nParagraph); - pOwner->SetDepth(pParagraph, nDepth); + Paragraph* pParagraph = rOwner.GetParagraph(nParagraph); + rOwner.SetDepth(pParagraph, nDepth); } sal_Int16 OutlinerView::GetDepth() const { ESelection aESelection = GetSelection(); aESelection.Adjust(); - sal_Int16 nDepth = pOwner->GetDepth(aESelection.start.nPara); + sal_Int16 nDepth = rOwner.GetDepth(aESelection.start.nPara); for (sal_Int32 nPara = aESelection.start.nPara + 1; nPara <= aESelection.end.nPara; ++nPara) { - if (nDepth != pOwner->GetDepth(nPara)) + if (nDepth != rOwner.GetDepth(nPara)) return -2; } return nDepth; @@ -412,10 +411,10 @@ sal_Int16 OutlinerView::GetDepth() const void OutlinerView::SetAttribs( const SfxItemSet& rAttrs ) { - bool bUpdate = pOwner->pEditEngine->SetUpdateLayout( false ); + bool bUpdate = rOwner.pEditEngine->SetUpdateLayout( false ); - if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() ) - pOwner->UndoActionStart( OLUNDO_ATTR ); + if( !rOwner.IsInUndo() && rOwner.IsUndoEnabled() ) + rOwner.UndoActionStart( OLUNDO_ATTR ); ParaRange aSel = ImpGetSelectedParagraphs( false ); @@ -424,15 +423,15 @@ void OutlinerView::SetAttribs( const SfxItemSet& rAttrs ) // Update Bullet text for( sal_Int32 nPara= aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) { - pOwner->ImplCheckNumBulletItem( nPara ); - pOwner->ImplCalcBulletText( nPara, false, false ); + rOwner.ImplCheckNumBulletItem( nPara ); + rOwner.ImplCalcBulletText( nPara, false, false ); - if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() ) - pOwner->InsertUndo( std::make_unique<OutlinerUndoCheckPara>( pOwner, nPara ) ); + if( !rOwner.IsInUndo() && rOwner.IsUndoEnabled() ) + rOwner.InsertUndo( std::make_unique<OutlinerUndoCheckPara>( &rOwner, nPara ) ); } - if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() ) - pOwner->UndoActionEnd(); + if( !rOwner.IsInUndo() && rOwner.IsUndoEnabled() ) + rOwner.UndoActionEnd(); pEditView->SetEditEngineUpdateLayout( bUpdate ); } @@ -446,9 +445,9 @@ ParaRange OutlinerView::ImpGetSelectedParagraphs( bool bIncludeHiddenChildren ) // Record the invisible Children of the last Parents in the selection if ( bIncludeHiddenChildren ) { - Paragraph* pLast = pOwner->pParaList->GetParagraph( aParas.nEndPara ); - if ( pOwner->pParaList->HasHiddenChildren( pLast ) ) - aParas.nEndPara = aParas.nEndPara + pOwner->pParaList->GetChildCount( pLast ); + Paragraph* pLast = rOwner.pParaList->GetParagraph( aParas.nEndPara ); + if ( rOwner.pParaList->HasHiddenChildren( pLast ) ) + aParas.nEndPara = aParas.nEndPara + rOwner.pParaList->GetChildCount( pLast ); } return aParas; } @@ -461,23 +460,23 @@ void OutlinerView::AdjustDepth( short nDX ) void OutlinerView::Indent( short nDiff ) { - if( !nDiff || ( ( nDiff > 0 ) && ImpCalcSelectedPages( true ) && !pOwner->ImpCanIndentSelectedPages( this ) ) ) + if( !nDiff || ( ( nDiff > 0 ) && ImpCalcSelectedPages( true ) && !rOwner.ImpCanIndentSelectedPages( this ) ) ) return; - const bool bOutlinerView = bool(pOwner->pEditEngine->GetControlWord() & EEControlBits::OUTLINER); - bool bUpdate = pOwner->pEditEngine->SetUpdateLayout( false ); + const bool bOutlinerView = bool(rOwner.pEditEngine->GetControlWord() & EEControlBits::OUTLINER); + bool bUpdate = rOwner.pEditEngine->SetUpdateLayout( false ); - bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled(); + bool bUndo = !rOwner.IsInUndo() && rOwner.IsUndoEnabled(); if( bUndo ) - pOwner->UndoActionStart( OLUNDO_DEPTH ); + rOwner.UndoActionStart( OLUNDO_DEPTH ); sal_Int16 nMinDepth = -1; // Optimization: avoid recalculate too many paragraphs if not really needed. ParaRange aSel = ImpGetSelectedParagraphs( true ); for ( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) { - Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); + Paragraph* pPara = rOwner.pParaList->GetParagraph( nPara ); sal_Int16 nOldDepth = pPara->GetDepth(); sal_Int16 nNewDepth = nOldDepth + nDiff; @@ -488,7 +487,7 @@ void OutlinerView::Indent( short nDiff ) if( (bPage && (nDiff == +1)) || (!bPage && (nDiff == -1) && (nOldDepth <= 0)) ) { // Notify App - pOwner->nDepthChangedHdlPrevDepth = nOldDepth; + rOwner.nDepthChangedHdlPrevDepth = nOldDepth; ParaFlag nPrevFlags = pPara->nFlags; if( bPage ) @@ -496,11 +495,11 @@ void OutlinerView::Indent( short nDiff ) else pPara->SetFlag( ParaFlag::ISPAGE ); - pOwner->DepthChangedHdl(pPara, nPrevFlags); - pOwner->pEditEngine->QuickMarkInvalid(ESelection(nPara, 0)); + rOwner.DepthChangedHdl(pPara, nPrevFlags); + rOwner.pEditEngine->QuickMarkInvalid(ESelection(nPara, 0)); if( bUndo ) - pOwner->InsertUndo( std::make_unique<OutlinerUndoChangeParaFlags>( pOwner, nPara, nPrevFlags, pPara->nFlags ) ); + rOwner.InsertUndo( std::make_unique<OutlinerUndoChangeParaFlags>( &rOwner, nPara, nPrevFlags, pPara->nFlags ) ); continue; } @@ -516,8 +515,8 @@ void OutlinerView::Indent( short nDiff ) if ( nNewDepth < Outliner::gnMinDepth ) nNewDepth = Outliner::gnMinDepth; - if ( nNewDepth > pOwner->nMaxDepth ) - nNewDepth = pOwner->nMaxDepth; + if ( nNewDepth > rOwner.nMaxDepth ) + nNewDepth = rOwner.nMaxDepth; if( nOldDepth < nMinDepth ) nMinDepth = nOldDepth; @@ -526,57 +525,57 @@ void OutlinerView::Indent( short nDiff ) if( nOldDepth != nNewDepth ) { - if ( ( nPara == aSel.nStartPara ) && aSel.nStartPara && ( pOwner->GetOutlinerMode() != OutlinerMode::TextObject )) + if ( ( nPara == aSel.nStartPara ) && aSel.nStartPara && ( rOwner.GetOutlinerMode() != OutlinerMode::TextObject )) { // Special case: the predecessor of an indented paragraph is // invisible and is now on the same level as the visible // paragraph. In this case, the next visible paragraph is // searched for and fluffed. #ifdef DBG_UTIL - Paragraph* _pPara = pOwner->pParaList->GetParagraph( aSel.nStartPara ); + Paragraph* _pPara = rOwner.pParaList->GetParagraph( aSel.nStartPara ); DBG_ASSERT(_pPara->IsVisible(),"Selected Paragraph invisible ?!"); #endif - Paragraph* pPrev= pOwner->pParaList->GetParagraph( aSel.nStartPara-1 ); + Paragraph* pPrev= rOwner.pParaList->GetParagraph( aSel.nStartPara-1 ); if( !pPrev->IsVisible() && ( pPrev->GetDepth() == nNewDepth ) ) { // Predecessor is collapsed and is on the same level // => find next visible paragraph and expand it - pPrev = pOwner->pParaList->GetParent( pPrev ); + pPrev = rOwner.pParaList->GetParent( pPrev ); while( !pPrev->IsVisible() ) - pPrev = pOwner->pParaList->GetParent( pPrev ); + pPrev = rOwner.pParaList->GetParent( pPrev ); - pOwner->Expand( pPrev ); - pOwner->InvalidateBullet(pOwner->pParaList->GetAbsPos(pPrev)); + rOwner.Expand( pPrev ); + rOwner.InvalidateBullet(rOwner.pParaList->GetAbsPos(pPrev)); } } - pOwner->nDepthChangedHdlPrevDepth = nOldDepth; + rOwner.nDepthChangedHdlPrevDepth = nOldDepth; ParaFlag nPrevFlags = pPara->nFlags; - pOwner->ImplInitDepth( nPara, nNewDepth, true ); - pOwner->ImplCalcBulletText( nPara, false, false ); + rOwner.ImplInitDepth( nPara, nNewDepth, true ); + rOwner.ImplCalcBulletText( nPara, false, false ); - if ( pOwner->GetOutlinerMode() == OutlinerMode::OutlineObject ) - pOwner->ImplSetLevelDependentStyleSheet( nPara ); + if ( rOwner.GetOutlinerMode() == OutlinerMode::OutlineObject ) + rOwner.ImplSetLevelDependentStyleSheet( nPara ); // Notify App - pOwner->DepthChangedHdl(pPara, nPrevFlags); + rOwner.DepthChangedHdl(pPara, nPrevFlags); } else { // Needs at least a repaint... - pOwner->pEditEngine->QuickMarkInvalid(ESelection(nPara, 0)); + rOwner.pEditEngine->QuickMarkInvalid(ESelection(nPara, 0)); } } - sal_Int32 nParas = pOwner->pParaList->GetParagraphCount(); + sal_Int32 nParas = rOwner.pParaList->GetParagraphCount(); for ( sal_Int32 n = aSel.nEndPara+1; n < nParas; n++ ) { - Paragraph* pPara = pOwner->pParaList->GetParagraph( n ); + Paragraph* pPara = rOwner.pParaList->GetParagraph( n ); if ( pPara->GetDepth() < nMinDepth ) break; - pOwner->ImplCalcBulletText( n, false, false ); + rOwner.ImplCalcBulletText( n, false, false ); } if ( bUpdate ) @@ -586,7 +585,7 @@ void OutlinerView::Indent( short nDiff ) } if( bUndo ) - pOwner->UndoActionEnd(); + rOwner.UndoActionEnd(); } void OutlinerView::AdjustHeight( tools::Long nDY ) @@ -615,40 +614,40 @@ void OutlinerView::Collapse() void OutlinerView::ExpandAll() { - ImplExpandOrCollaps( 0, pOwner->pParaList->GetParagraphCount()-1, true ); + ImplExpandOrCollaps( 0, rOwner.pParaList->GetParagraphCount()-1, true ); } void OutlinerView::CollapseAll() { - ImplExpandOrCollaps( 0, pOwner->pParaList->GetParagraphCount()-1, false ); + ImplExpandOrCollaps( 0, rOwner.pParaList->GetParagraphCount()-1, false ); } void OutlinerView::ImplExpandOrCollaps( sal_Int32 nStartPara, sal_Int32 nEndPara, bool bExpand ) { - bool bUpdate = pOwner->SetUpdateLayout( false ); + bool bUpdate = rOwner.SetUpdateLayout( false ); - bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled(); + bool bUndo = !rOwner.IsInUndo() && rOwner.IsUndoEnabled(); if( bUndo ) - pOwner->UndoActionStart( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE ); + rOwner.UndoActionStart( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE ); for ( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ ) { - Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - bool bDone = bExpand ? pOwner->Expand( pPara ) : pOwner->Collapse( pPara ); + Paragraph* pPara = rOwner.pParaList->GetParagraph( nPara ); + bool bDone = bExpand ? rOwner.Expand( pPara ) : rOwner.Collapse( pPara ); if( bDone ) { // The line under the paragraph should disappear ... - pOwner->pEditEngine->QuickMarkToBeRepainted( nPara ); + rOwner.pEditEngine->QuickMarkToBeRepainted( nPara ); } } if( bUndo ) - pOwner->UndoActionEnd(); + rOwner.UndoActionEnd(); if ( bUpdate ) { - pOwner->SetUpdateLayout( true ); + rOwner.SetUpdateLayout( true ); pEditView->ShowCursor(); } } @@ -664,20 +663,20 @@ void OutlinerView::InsertText( const OutlinerParaObject& rParaObj ) // Possibly problematic: // EditEngine, RTF => Splitting the area, later join together. - if ( ImpCalcSelectedPages( false ) && !pOwner->ImpCanDeleteSelectedPages( this ) ) + if ( ImpCalcSelectedPages( false ) && !rOwner.ImpCanDeleteSelectedPages( this ) ) return; - pOwner->UndoActionStart( OLUNDO_INSERT ); + rOwner.UndoActionStart( OLUNDO_INSERT ); - const bool bPrevUpdateLayout = pOwner->pEditEngine->SetUpdateLayout( false ); + const bool bPrevUpdateLayout = rOwner.pEditEngine->SetUpdateLayout( false ); sal_Int32 nStart, nParaCount; - nParaCount = pOwner->pEditEngine->GetParagraphCount(); + nParaCount = rOwner.pEditEngine->GetParagraphCount(); sal_uInt16 nSize = ImpInitPaste( nStart ); pEditView->InsertText( rParaObj.GetTextObject() ); ImpPasted( nStart, nParaCount, nSize); pEditView->SetEditEngineUpdateLayout( bPrevUpdateLayout ); - pOwner->UndoActionEnd(); + rOwner.UndoActionEnd(); pEditView->ShowCursor(); } @@ -685,7 +684,7 @@ void OutlinerView::InsertText( const OutlinerParaObject& rParaObj ) void OutlinerView::Cut() { - if ( !ImpCalcSelectedPages( false ) || pOwner->ImpCanDeleteSelectedPages( this ) ) { + if ( !ImpCalcSelectedPages( false ) || rOwner.ImpCanDeleteSelectedPages( this ) ) { pEditView->Cut(); // Chaining handling aEndCutPasteLink.Call(nullptr); @@ -699,29 +698,29 @@ void OutlinerView::PasteSpecial(SotClipboardFormatId format) void OutlinerView::Paste( bool bUseSpecial, SotClipboardFormatId format) { - if ( ImpCalcSelectedPages( false ) && !pOwner->ImpCanDeleteSelectedPages( this ) ) + if ( ImpCalcSelectedPages( false ) && !rOwner.ImpCanDeleteSelectedPages( this ) ) return; - pOwner->UndoActionStart( OLUNDO_INSERT ); + rOwner.UndoActionStart( OLUNDO_INSERT ); - const bool bPrevUpdateLayout = pOwner->pEditEngine->SetUpdateLayout( false ); - pOwner->bPasting = true; + const bool bPrevUpdateLayout = rOwner.pEditEngine->SetUpdateLayout( false ); + rOwner.bPasting = true; if ( bUseSpecial ) pEditView->PasteSpecial(format); else pEditView->Paste(); - if ( pOwner->GetOutlinerMode() == OutlinerMode::OutlineObject ) + if ( rOwner.GetOutlinerMode() == OutlinerMode::OutlineObject ) { - const sal_Int32 nParaCount = pOwner->pEditEngine->GetParagraphCount(); + const sal_Int32 nParaCount = rOwner.pEditEngine->GetParagraphCount(); for( sal_Int32 nPara = 0; nPara < nParaCount; nPara++ ) - pOwner->ImplSetLevelDependentStyleSheet( nPara ); + rOwner.ImplSetLevelDependentStyleSheet( nPara ); } pEditView->SetEditEngineUpdateLayout( bPrevUpdateLayout ); - pOwner->UndoActionEnd(); + rOwner.UndoActionEnd(); pEditView->ShowCursor(); // Chaining handling @@ -735,7 +734,7 @@ void OutlinerView::CreateSelectionList (std::vector<Paragraph*> &aSelList) for ( sal_Int32 nPara = aParas.nStartPara; nPara <= aParas.nEndPara; nPara++ ) { - Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); + Paragraph* pPara = rOwner.pParaList->GetParagraph( nPara ); aSelList.push_back(pPara); } } @@ -744,12 +743,12 @@ void OutlinerView::SetStyleSheet(const OUString& rStyleName) { ParaRange aParas = ImpGetSelectedParagraphs(false); - auto pStyle = pOwner->GetStyleSheetPool()->Find(rStyleName, SfxStyleFamily::Para); + auto pStyle = rOwner.GetStyleSheetPool()->Find(rStyleName, SfxStyleFamily::Para); if (!pStyle) return; for (sal_Int32 nPara = aParas.nStartPara; nPara <= aParas.nEndPara; nPara++) - pOwner->SetStyleSheet(nPara, static_cast<SfxStyleSheet*>(pStyle)); + rOwner.SetStyleSheet(nPara, static_cast<SfxStyleSheet*>(pStyle)); } const SfxStyleSheet* OutlinerView::GetStyleSheet() const @@ -770,7 +769,7 @@ PointerStyle OutlinerView::GetPointer( const Point& rPosPixel ) PointerStyle ePointerStyle = PointerStyle::Arrow; if ( eTarget == MouseTarget::Text ) { - ePointerStyle = GetOutliner()->IsVertical() ? PointerStyle::TextVertical : PointerStyle::Text; + ePointerStyle = GetOutliner().IsVertical() ? PointerStyle::TextVertical : PointerStyle::Text; } else if ( eTarget == MouseTarget::Hypertext ) { @@ -787,7 +786,7 @@ PointerStyle OutlinerView::GetPointer( const Point& rPosPixel ) sal_Int32 OutlinerView::ImpInitPaste( sal_Int32& rStart ) { - pOwner->bPasting = true; + rOwner.bPasting = true; ESelection aSelection( pEditView->GetSelection() ); aSelection.Adjust(); rStart = aSelection.start.nPara; @@ -798,13 +797,13 @@ sal_Int32 OutlinerView::ImpInitPaste( sal_Int32& rStart ) void OutlinerView::ImpPasted( sal_Int32 nStart, sal_Int32 nPrevParaCount, sal_Int32 nSize) { - pOwner->bPasting = false; - sal_Int32 nCurParaCount = pOwner->pEditEngine->GetParagraphCount(); + rOwner.bPasting = false; + sal_Int32 nCurParaCount = rOwner.pEditEngine->GetParagraphCount(); if( nCurParaCount < nPrevParaCount ) nSize = nSize - ( nPrevParaCount - nCurParaCount ); else nSize = nSize + ( nCurParaCount - nPrevParaCount ); - pOwner->ImpTextPasted( nStart, nSize ); + rOwner.ImpTextPasted( nStart, nSize ); } bool OutlinerView::Command(const CommandEvent& rCEvt) @@ -831,7 +830,7 @@ sal_Int32 OutlinerView::ImpCalcSelectedPages( bool bIncludeFirstSelected ) nStartPara++; // All paragraphs after StartPara will be deleted for (sal_Int32 nPara = nStartPara; nPara <= aSel.end.nPara; nPara++) { - Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); + Paragraph* pPara = rOwner.pParaList->GetParagraph( nPara ); assert(pPara && "ImpCalcSelectedPages: invalid Selection?"); if( pPara->HasFlag(ParaFlag::ISPAGE) ) { @@ -843,8 +842,8 @@ sal_Int32 OutlinerView::ImpCalcSelectedPages( bool bIncludeFirstSelected ) if( nPages ) { - pOwner->nDepthChangedHdlPrevDepth = nPages; - pOwner->mnFirstSelPage = nFirstPage; + rOwner.nDepthChangedHdlPrevDepth = nPages; + rOwner.mnFirstSelPage = nFirstPage; } return nPages; @@ -853,77 +852,77 @@ sal_Int32 OutlinerView::ImpCalcSelectedPages( bool bIncludeFirstSelected ) void OutlinerView::ToggleBullets() { - pOwner->UndoActionStart( OLUNDO_DEPTH ); + rOwner.UndoActionStart( OLUNDO_DEPTH ); ESelection aSel( pEditView->GetSelection() ); aSel.Adjust(); - const bool bUpdate = pOwner->pEditEngine->SetUpdateLayout( false ); + const bool bUpdate = rOwner.pEditEngine->SetUpdateLayout( false ); sal_Int16 nNewDepth = -2; const SvxNumRule* pDefaultBulletNumRule = nullptr; for (sal_Int32 nPara = aSel.start.nPara; nPara <= aSel.end.nPara; nPara++) { - Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); + Paragraph* pPara = rOwner.pParaList->GetParagraph( nPara ); DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?"); if( pPara ) { if( nNewDepth == -2 ) { - nNewDepth = (pOwner->GetDepth(nPara) == -1) ? 0 : -1; + nNewDepth = (rOwner.GetDepth(nPara) == -1) ? 0 : -1; if ( nNewDepth == 0 ) { // determine default numbering rule for bullets const ESelection aSelection(nPara, 0); - const SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection)); + const SfxItemSet aTmpSet(rOwner.pEditEngine->GetAttribs(aSelection)); const SfxPoolItem& rPoolItem = aTmpSet.GetPool()->GetUserOrPoolDefaultItem( EE_PARA_NUMBULLET ); const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(&rPoolItem); pDefaultBulletNumRule = pNumBulletItem ? &pNumBulletItem->GetNumRule() : nullptr; } } - pOwner->SetDepth( pPara, nNewDepth ); + rOwner.SetDepth( pPara, nNewDepth ); if( nNewDepth == -1 ) { - const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara ); + const SfxItemSet& rAttrs = rOwner.GetParaAttribs( nPara ); if ( rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SfxItemState::SET ) { SfxItemSet aAttrs(rAttrs); aAttrs.ClearItem( EE_PARA_BULLETSTATE ); - pOwner->SetParaAttribs( nPara, aAttrs ); + rOwner.SetParaAttribs( nPara, aAttrs ); } } else { if ( pDefaultBulletNumRule ) { - const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat( nPara ); + const SvxNumberFormat* pFmt = rOwner.GetNumberFormat( nPara ); if ( !pFmt || ( pFmt->GetNumberingType() != SVX_NUM_BITMAP && pFmt->GetNumberingType() != SVX_NUM_CHAR_SPECIAL ) ) { - SfxItemSet aAttrs( pOwner->GetParaAttribs( nPara ) ); + SfxItemSet aAttrs( rOwner.GetParaAttribs( nPara ) ); SvxNumRule aNewNumRule( *pDefaultBulletNumRule ); aAttrs.Put( SvxNumBulletItem( std::move(aNewNumRule), EE_PARA_NUMBULLET ) ); - pOwner->SetParaAttribs( nPara, aAttrs ); + rOwner.SetParaAttribs( nPara, aAttrs ); } } } } } - const sal_Int32 nParaCount = pOwner->pParaList->GetParagraphCount(); - pOwner->ImplCheckParagraphs(aSel.start.nPara, nParaCount); + const sal_Int32 nParaCount = rOwner.pParaList->GetParagraphCount(); + rOwner.ImplCheckParagraphs(aSel.start.nPara, nParaCount); sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount; - pOwner->pEditEngine->QuickMarkInvalid(ESelection(aSel.start.nPara, 0, nEndPara, 0)); + rOwner.pEditEngine->QuickMarkInvalid(ESelection(aSel.start.nPara, 0, nEndPara, 0)); - pOwner->pEditEngine->SetUpdateLayout( bUpdate ); + rOwner.pEditEngine->SetUpdateLayout( bUpdate ); - pOwner->UndoActionEnd(); + rOwner.UndoActionEnd(); } bool OutlinerView::IsBulletOrNumbering(bool& bBullets, bool& bNumbering) @@ -937,14 +936,14 @@ bool OutlinerView::IsBulletOrNumbering(bool& bBullets, bool& bNumbering) aSel.Adjust(); for (sal_Int32 nPara = aSel.start.nPara; nPara <= aSel.end.nPara; nPara++) { - Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); + Paragraph* pPara = rOwner.pParaList->GetParagraph( nPara ); DBG_ASSERT(pPara, "OutlinerView::IsBulletOrNumbering(), illegal selection?"); if( pPara ) { - if (pOwner->GetDepth(nPara) < 0) + if (rOwner.GetDepth(nPara) < 0) return false; - const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara); + const SvxNumberFormat* pFmt = rOwner.GetNumberFormat(nPara); if (pFmt) { sal_Int16 nNumType = pFmt->GetNumberingType(); @@ -978,7 +977,7 @@ void OutlinerView::ToggleBulletsNumbering( if ( bToggle ) { bToggleOn = false; - const sal_Int16 nBulletNumberingStatus( pOwner->GetBulletsNumberingStatus( aSel.start.nPara, aSel.end.nPara ) ); + const sal_Int16 nBulletNumberingStatus( rOwner.GetBulletsNumberingStatus( aSel.start.nPara, aSel.end.nPara ) ); if ( nBulletNumberingStatus != 0 && bHandleBullets ) { // not all paragraphs have bullets and method called to toggle bullets --> bullets on @@ -1004,32 +1003,32 @@ void OutlinerView::ToggleBulletsNumbering( void OutlinerView::EnsureNumberingIsOn() { - pOwner->UndoActionStart(OLUNDO_DEPTH); + rOwner.UndoActionStart(OLUNDO_DEPTH); ESelection aSel(pEditView->GetSelection()); aSel.Adjust(); - const bool bUpdate = pOwner->pEditEngine->IsUpdateLayout(); - pOwner->pEditEngine->SetUpdateLayout(false); + const bool bUpdate = rOwner.pEditEngine->IsUpdateLayout(); + rOwner.pEditEngine->SetUpdateLayout(false); for (sal_Int32 nPara = aSel.start.nPara; nPara <= aSel.end.nPara; nPara++) { - Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara); + Paragraph* pPara = rOwner.pParaList->GetParagraph(nPara); DBG_ASSERT(pPara, "OutlinerView::EnableBullets(), illegal selection?"); - if (pPara && pOwner->GetDepth(nPara) == -1) - pOwner->SetDepth(pPara, 0); + if (pPara && rOwner.GetDepth(nPara) == -1) + rOwner.SetDepth(pPara, 0); } - sal_Int32 nParaCount = pOwner->pParaList->GetParagraphCount(); - pOwner->ImplCheckParagraphs(aSel.start.nPara, nParaCount); + sal_Int32 nParaCount = rOwner.pParaList->GetParagraphCount(); + rOwner.ImplCheckParagraphs(aSel.start.nPara, nParaCount); const sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount; - pOwner->pEditEngine->QuickMarkInvalid(ESelection(aSel.start.nPara, 0, nEndPara, 0)); + rOwner.pEditEngine->QuickMarkInvalid(ESelection(aSel.start.nPara, 0, nEndPara, 0)); - pOwner->pEditEngine->SetUpdateLayout(bUpdate); + rOwner.pEditEngine->SetUpdateLayout(bUpdate); - pOwner->UndoActionEnd(); + rOwner.UndoActionEnd(); } void OutlinerView::ApplyBulletsNumbering( @@ -1038,13 +1037,11 @@ void OutlinerView::ApplyBulletsNumbering( const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule, const bool bAtSelection ) { - if (!pOwner || !pOwner->pEditEngine || !pOwner->pParaList) - { + if (!rOwner.pEditEngine || !rOwner.pParaList) return; - } - pOwner->UndoActionStart(OLUNDO_DEPTH); - const bool bUpdate = pOwner->pEditEngine->SetUpdateLayout(false); + rOwner.UndoActionStart(OLUNDO_DEPTH); + const bool bUpdate = rOwner.pEditEngine->SetUpdateLayout(false); sal_Int32 nStartPara = 0; sal_Int32 nEndPara = 0; @@ -1058,23 +1055,23 @@ void OutlinerView::ApplyBulletsNumbering( else { nStartPara = 0; - nEndPara = pOwner->pParaList->GetParagraphCount() - 1; + nEndPara = rOwner.pParaList->GetParagraphCount() - 1; } for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara) { - Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara); + Paragraph* pPara = rOwner.pParaList->GetParagraph(nPara); DBG_ASSERT(pPara, "OutlinerView::ApplyBulletsNumbering(..), illegal selection?"); if (pPara) { - const sal_Int16 nDepth = pOwner->GetDepth(nPara); + const sal_Int16 nDepth = rOwner.GetDepth(nPara); if ( nDepth == -1 ) { - pOwner->SetDepth( pPara, 0 ); + rOwner.SetDepth( pPara, 0 ); } - const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara); + const SfxItemSet& rAttrs = rOwner.GetParaAttribs(nPara); SfxItemSet aAttrs(rAttrs); aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, true)); @@ -1088,7 +1085,7 @@ void OutlinerView::ApplyBulletsNumbering( } else { - const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara); + const SvxNumberFormat* pFmt = rOwner.GetNumberFormat(nPara); if (!pFmt) { bApplyNumRule = true; @@ -1122,7 +1119,7 @@ void OutlinerView::ApplyBulletsNumbering( { // Use default value when has not contain bullet item. ESelection aSelection(nPara, 0); - SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection)); + SfxItemSet aTmpSet(rOwner.pEditEngine->GetAttribs(aSelection)); pNumBulletItem = aTmpSet.GetItem(EE_PARA_NUMBULLET); } @@ -1147,17 +1144,17 @@ void OutlinerView::ApplyBulletsNumbering( aAttrs.Put(SvxNumBulletItem(std::move(aNewRule), EE_PARA_NUMBULLET)); } } - pOwner->SetParaAttribs(nPara, aAttrs); + rOwner.SetParaAttribs(nPara, aAttrs); } } - const sal_uInt16 nParaCount = static_cast<sal_uInt16>(pOwner->pParaList->GetParagraphCount()); - pOwner->ImplCheckParagraphs( nStartPara, nParaCount ); - pOwner->pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) ); + const sal_uInt16 nParaCount = static_cast<sal_uInt16>(rOwner.pParaList->GetParagraphCount()); + rOwner.ImplCheckParagraphs( nStartPara, nParaCount ); + rOwner.pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) ); - pOwner->pEditEngine->SetUpdateLayout( bUpdate ); + rOwner.pEditEngine->SetUpdateLayout( bUpdate ); - pOwner->UndoActionEnd(); + rOwner.UndoActionEnd(); } @@ -1176,37 +1173,37 @@ void OutlinerView::SwitchOffBulletsNumbering( else { nStartPara = 0; - nEndPara = pOwner->pParaList->GetParagraphCount() - 1; + nEndPara = rOwner.pParaList->GetParagraphCount() - 1; } - pOwner->UndoActionStart( OLUNDO_DEPTH ); - const bool bUpdate = pOwner->pEditEngine->SetUpdateLayout( false ); + rOwner.UndoActionStart( OLUNDO_DEPTH ); + const bool bUpdate = rOwner.pEditEngine->SetUpdateLayout( false ); for ( sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara ) { - Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); + Paragraph* pPara = rOwner.pParaList->GetParagraph( nPara ); DBG_ASSERT(pPara, "OutlinerView::SwitchOffBulletsNumbering(...), illegal paragraph index?"); if( pPara ) { - pOwner->SetDepth( pPara, -1 ); + rOwner.SetDepth( pPara, -1 ); - const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara ); + const SfxItemSet& rAttrs = rOwner.GetParaAttribs( nPara ); if (rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SfxItemState::SET) { SfxItemSet aAttrs(rAttrs); aAttrs.ClearItem( EE_PARA_BULLETSTATE ); - pOwner->SetParaAttribs( nPara, aAttrs ); + rOwner.SetParaAttribs( nPara, aAttrs ); } } } - const sal_uInt16 nParaCount = static_cast<sal_uInt16>(pOwner->pParaList->GetParagraphCount()); - pOwner->ImplCheckParagraphs( nStartPara, nParaCount ); - pOwner->pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) ); + const sal_uInt16 nParaCount = static_cast<sal_uInt16>(rOwner.pParaList->GetParagraphCount()); + rOwner.ImplCheckParagraphs( nStartPara, nParaCount ); + rOwner.pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) ); - pOwner->pEditEngine->SetUpdateLayout( bUpdate ); - pOwner->UndoActionEnd(); + rOwner.pEditEngine->SetUpdateLayout( bUpdate ); + rOwner.UndoActionEnd(); } @@ -1217,8 +1214,8 @@ void OutlinerView::RemoveAttribsKeepLanguages( bool bRemoveParaAttribs ) void OutlinerView::RemoveAttribs( bool bRemoveParaAttribs, bool bKeepLanguages ) { - bool bUpdate = pOwner->SetUpdateLayout( false ); - pOwner->UndoActionStart( OLUNDO_ATTR ); + bool bUpdate = rOwner.SetUpdateLayout( false ); + rOwner.UndoActionStart( OLUNDO_ATTR ); if (bKeepLanguages) pEditView->RemoveAttribsKeepLanguages( bRemoveParaAttribs ); else @@ -1230,12 +1227,12 @@ void OutlinerView::RemoveAttribs( bool bRemoveParaAttribs, bool bKeepLanguages ) aSel.Adjust(); for (sal_Int32 nPara = aSel.start.nPara; nPara <= aSel.end.nPara; nPara++) { - Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - pOwner->ImplInitDepth( nPara, pPara->GetDepth(), false ); + Paragraph* pPara = rOwner.pParaList->GetParagraph( nPara ); + rOwner.ImplInitDepth( nPara, pPara->GetDepth(), false ); } } - pOwner->UndoActionEnd(); - pOwner->SetUpdateLayout( bUpdate ); + rOwner.UndoActionEnd(); + rOwner.SetUpdateLayout( bUpdate ); } @@ -1244,8 +1241,8 @@ void OutlinerView::RemoveAttribs( bool bRemoveParaAttribs, bool bKeepLanguages ) void OutlinerView::InsertText( const OUString& rNew, bool bSelect ) { - if( pOwner->bFirstParaIsEmpty ) - pOwner->Insert( OUString() ); + if( rOwner.bFirstParaIsEmpty ) + rOwner.Insert( OUString() ); pEditView->InsertText( rNew, bSelect ); } @@ -1454,11 +1451,11 @@ void OutlinerView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueItera for ( sal_Int32 n = nChangesStart; n <= nChangesEnd; n++ ) { - if ( pOwner->GetOutlinerMode() == OutlinerMode::OutlineObject ) - pOwner->ImplSetLevelDependentStyleSheet( n ); + if ( rOwner.GetOutlinerMode() == OutlinerMode::OutlineObject ) + rOwner.ImplSetLevelDependentStyleSheet( n ); } - pOwner->ImpFilterIndents( nChangesStart, nChangesEnd ); + rOwner.ImpFilterIndents( nChangesStart, nChangesEnd ); } void OutlinerView::SetBackgroundColor( const Color& rColor ) diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index d1c6c840ca07..8be662616ce4 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -182,7 +182,7 @@ class EDITENG_DLLPUBLIC OutlinerView final { friend class Outliner; - Outliner* pOwner; + Outliner& rOwner; std::unique_ptr<EditView> pEditView; enum class MouseTarget { @@ -205,8 +205,8 @@ class EDITENG_DLLPUBLIC OutlinerView final Link<LinkParamNone*,void> aEndCutPasteLink; public: - OutlinerView( Outliner* pOut, vcl::Window* pWindow ); - ~OutlinerView(); + OutlinerView(Outliner& rOutliner, vcl::Window* pWindow); + ~OutlinerView(); EditView& GetEditView() const { return *pEditView; } @@ -223,7 +223,7 @@ public: void HideCursor( bool bDeactivate = false ); bool IsCursorVisible() const; - Outliner* GetOutliner() const { return pOwner; } + Outliner& GetOutliner() const { return rOwner; } void SetWindow( vcl::Window* pWindow ); vcl::Window* GetWindow() const; @@ -643,6 +643,8 @@ private: SAL_DLLPRIVATE void ImplCheckDepth( sal_Int16& rnDepth ) const; + SAL_DLLPRIVATE OutlinerEditEng& getOutlinerEditEng() { return *pEditEngine; } + protected: SAL_DLLPRIVATE void ParagraphInserted( sal_Int32 nParagraph ); SAL_DLLPRIVATE void ParagraphDeleted( sal_Int32 nParagraph ); diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index d31a1a392654..407a5caf9501 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -247,7 +247,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) aSet.PutAsTargetWhich( *aNewItem, EE_CHAR_FONTINFO ); // If nothing is selected, then SetAttribs of the View selects a word - pOutView->GetOutliner()->QuickSetAttribs( aSet, pOutView->GetSelection() ); + pOutView->GetOutliner().QuickSetAttribs( aSet, pOutView->GetSelection() ); pOutView->InsertText(aString); } @@ -587,21 +587,20 @@ static void lcl_RemoveFields( OutlinerView& rOutView ) { //! Outliner should have RemoveFields with a selection - Outliner* pOutliner = rOutView.GetOutliner(); - if (!pOutliner) return; + Outliner& rOutliner = rOutView.GetOutliner(); ESelection aOldSel = rOutView.GetSelection(); ESelection aSel = aOldSel; aSel.Adjust(); sal_Int32 nNewEnd = aSel.end.nIndex; - bool bUpdate = pOutliner->IsUpdateLayout(); + bool bUpdate = rOutliner.IsUpdateLayout(); bool bChanged = false; //! GetPortions and GetAttribs should be const! - EditEngine& rEditEng = const_cast<EditEngine&>(pOutliner->GetEditEngine()); + EditEngine& rEditEng = const_cast<EditEngine&>(rOutliner.GetEditEngine()); - sal_Int32 nParCount = pOutliner->GetParagraphCount(); + sal_Int32 nParCount = rOutliner.GetParagraphCount(); for (sal_Int32 nPar=0; nPar<nParCount; nPar++) if (nPar >= aSel.start.nPara && nPar <= aSel.end.nPara) { @@ -625,17 +624,17 @@ static void lcl_RemoveFields( OutlinerView& rOutView ) if (!bChanged) { if (bUpdate) - pOutliner->SetUpdateLayout( false ); + rOutliner.SetUpdateLayout( false ); OUString aName = ScResId( STR_UNDO_DELETECONTENTS ); ViewShellId nViewShellId(-1); if (ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell()) nViewShellId = pViewSh->GetViewShellId(); - pOutliner->GetUndoManager().EnterListAction( aName, aName, 0, nViewShellId ); + rOutliner.GetUndoManager().EnterListAction( aName, aName, 0, nViewShellId ); bChanged = true; } OUString aFieldText = rEditEng.GetText( aFieldSel ); - pOutliner->QuickInsertText( aFieldText, aFieldSel ); + rOutliner.QuickInsertText( aFieldText, aFieldSel ); if (nPar == aSel.end.nPara) { nNewEnd = nNewEnd + aFieldText.getLength(); @@ -648,8 +647,8 @@ static void lcl_RemoveFields( OutlinerView& rOutView ) if (bUpdate && bChanged) { - pOutliner->GetUndoManager().LeaveListAction(); - pOutliner->SetUpdateLayout( true ); + rOutliner.GetUndoManager().LeaveListAction(); + rOutliner.SetUpdateLayout( true ); } if ( aOldSel == aSel ) // aSel is adjusted diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index b0bca4f2b47c..008efbaededa 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -3607,12 +3607,12 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCCOL nCellX, S { // handle selection within the OutlinerView - Outliner* pOutliner = pOlView->GetOutliner(); - const EditEngine& rEditEngine = pOutliner->GetEditEngine(); + Outliner& rOutliner = pOlView->GetOutliner(); + const EditEngine& rEditEngine = rOutliner.GetEditEngine(); tools::Rectangle aVisArea = pOlView->GetVisArea(); Point aTextPos = aLogicPos; - if ( pOutliner->IsVertical() ) // have to manually transform position + if ( rOutliner.IsVertical() ) // have to manually transform position { aTextPos -= aOutputArea.TopRight(); tools::Long nTemp = -aTextPos.X(); diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index 3ddca3f07933..fcb26c12398c 100644 --- a/sd/source/ui/annotations/annotationwindow.cxx +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -262,7 +262,7 @@ void AnnotationWindow::InitControls() if (OutputDevice* pDev = mpDoc->GetRefDevice()) mpOutliner->SetRefDevice( pDev ); - mpOutlinerView.reset( new OutlinerView ( mpOutliner.get(), nullptr) ); + mpOutlinerView.reset(new OutlinerView(*mpOutliner, nullptr)); mpOutliner->InsertView(mpOutlinerView.get() ); //create Scrollbars diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx index d3a907bce9aa..67ab7d32ccfb 100644 --- a/sd/source/ui/func/fubullet.cxx +++ b/sd/source/ui/func/fubullet.cxx @@ -270,7 +270,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest const & rReq ) pOV->SetSelection(aSel); // do not go ahead with setting attributes of special characters - pOV->GetOutliner()->QuickSetAttribs(aOldSet, aSel); + pOV->GetOutliner().QuickSetAttribs(aOldSet, aSel); rUndoMgr.LeaveListAction(); diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 4d492cb412e6..e9fc1eee39b0 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -666,33 +666,33 @@ bool FuInsertFile::InsSDDinOlMode(SfxMedium* pMedium) // read in like in the character mode if (InsSDDinDrMode(pMedium)) { - ::Outliner* pOutliner = pOlView->GetViewByWindow(mpWindow)->GetOutliner(); + ::Outliner& rOutliner = pOlView->GetViewByWindow(mpWindow)->GetOutliner(); // cut notification links temporarily - Link<Outliner::ParagraphHdlParam,void> aOldParagraphInsertedHdl = pOutliner->GetParaInsertedHdl(); - pOutliner->SetParaInsertedHdl( Link<Outliner::ParagraphHdlParam,void>()); - Link<Outliner::ParagraphHdlParam,void> aOldParagraphRemovingHdl = pOutliner->GetParaRemovingHdl(); - pOutliner->SetParaRemovingHdl( Link<Outliner::ParagraphHdlParam,void>()); - Link<Outliner::DepthChangeHdlParam,void> aOldDepthChangedHdl = pOutliner->GetDepthChangedHdl(); - pOutliner->SetDepthChangedHdl( Link<::Outliner::DepthChangeHdlParam,void>()); - Link<::Outliner*,void> aOldBeginMovingHdl = pOutliner->GetBeginMovingHdl(); - pOutliner->SetBeginMovingHdl( Link<::Outliner*,void>()); - Link<::Outliner*,void> aOldEndMovingHdl = pOutliner->GetEndMovingHdl(); - pOutliner->SetEndMovingHdl( Link<::Outliner*,void>()); - - Link<EditStatus&,void> aOldStatusEventHdl = pOutliner->GetStatusEventHdl(); - pOutliner->SetStatusEventHdl(Link<EditStatus&,void>()); - - pOutliner->Clear(); + Link<Outliner::ParagraphHdlParam,void> aOldParagraphInsertedHdl = rOutliner.GetParaInsertedHdl(); + rOutliner.SetParaInsertedHdl( Link<Outliner::ParagraphHdlParam,void>()); + Link<Outliner::ParagraphHdlParam,void> aOldParagraphRemovingHdl = rOutliner.GetParaRemovingHdl(); + rOutliner.SetParaRemovingHdl( Link<Outliner::ParagraphHdlParam,void>()); + Link<Outliner::DepthChangeHdlParam,void> aOldDepthChangedHdl = rOutliner.GetDepthChangedHdl(); + rOutliner.SetDepthChangedHdl( Link<::Outliner::DepthChangeHdlParam,void>()); + Link<::Outliner*,void> aOldBeginMovingHdl = rOutliner.GetBeginMovingHdl(); + rOutliner.SetBeginMovingHdl( Link<::Outliner*,void>()); + Link<::Outliner*,void> aOldEndMovingHdl = rOutliner.GetEndMovingHdl(); + rOutliner.SetEndMovingHdl( Link<::Outliner*,void>()); + + Link<EditStatus&,void> aOldStatusEventHdl = rOutliner.GetStatusEventHdl(); + rOutliner.SetStatusEventHdl(Link<EditStatus&,void>()); + + rOutliner.Clear(); pOlView->FillOutliner(); // set links again - pOutliner->SetParaInsertedHdl(aOldParagraphInsertedHdl); - pOutliner->SetParaRemovingHdl(aOldParagraphRemovingHdl); - pOutliner->SetDepthChangedHdl(aOldDepthChangedHdl); - pOutliner->SetBeginMovingHdl(aOldBeginMovingHdl); - pOutliner->SetEndMovingHdl(aOldEndMovingHdl); - pOutliner->SetStatusEventHdl(aOldStatusEventHdl); + rOutliner.SetParaInsertedHdl(aOldParagraphInsertedHdl); + rOutliner.SetParaRemovingHdl(aOldParagraphRemovingHdl); + rOutliner.SetDepthChangedHdl(aOldDepthChangedHdl); + rOutliner.SetBeginMovingHdl(aOldBeginMovingHdl); + rOutliner.SetEndMovingHdl(aOldEndMovingHdl); + rOutliner.SetStatusEventHdl(aOldStatusEventHdl); return true; } diff --git a/sd/source/ui/func/fuprobjs.cxx b/sd/source/ui/func/fuprobjs.cxx index ccf3b83122d9..9e333cc26091 100644 --- a/sd/source/ui/func/fuprobjs.cxx +++ b/sd/source/ui/func/fuprobjs.cxx @@ -80,19 +80,19 @@ void FuPresentationObjects::DoExecute( SfxRequest& ) sal_Int16 nDepth, nTmp; OutlineView* pOlView = static_cast<OutlineView*>(pOutlineViewShell->GetView()); OutlinerView* pOutlinerView = pOlView->GetViewByWindow( static_cast<Window*>(mpWindow) ); - ::Outliner* pOutl = pOutlinerView->GetOutliner(); + ::Outliner& rOutl = pOutlinerView->GetOutliner(); std::vector<Paragraph*> aSelList; pOutlinerView->CreateSelectionList(aSelList); Paragraph* pPara = aSelList.empty() ? nullptr : aSelList.front(); - nDepth = pOutl->GetDepth(pOutl->GetAbsPos( pPara ) ); + nDepth = rOutl.GetDepth(rOutl.GetAbsPos( pPara ) ); bool bPage = ::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ); for( const auto& rpPara : aSelList ) { - nTmp = pOutl->GetDepth( pOutl->GetAbsPos( rpPara ) ); + nTmp = rOutl.GetDepth( rOutl.GetAbsPos( rpPara ) ); if( nDepth != nTmp ) { diff --git a/sd/source/ui/view/NotesPanelView.cxx b/sd/source/ui/view/NotesPanelView.cxx index 42562275b70f..ffb47d56dd90 100644 --- a/sd/source/ui/view/NotesPanelView.cxx +++ b/sd/source/ui/view/NotesPanelView.cxx @@ -34,7 +34,7 @@ NotesPanelView::NotesPanelView(DrawDocShell& rDocSh, vcl::Window* pWindow, : ::sd::SimpleOutlinerView(*rDocSh.GetDoc(), pWindow->GetOutDev(), &rNotesPanelViewShell) , mrNotesPanelViewShell(rNotesPanelViewShell) , maOutliner(&mrDoc, OutlinerMode::TextObject) - , maOutlinerView(&maOutliner, pWindow) + , maOutlinerView(maOutliner, pWindow) , aModifyIdle("NotesEditWindow ModifyIdle") { aModifyIdle.SetInvokeHandler(LINK(this, NotesPanelView, ModifyTimerHdl)); diff --git a/sd/source/ui/view/NotesPanelViewShell.cxx b/sd/source/ui/view/NotesPanelViewShell.cxx index 2a1fba11e6ff..fec2a609e4f9 100644 --- a/sd/source/ui/view/NotesPanelViewShell.cxx +++ b/sd/source/ui/view/NotesPanelViewShell.cxx @@ -314,8 +314,8 @@ void NotesPanelViewShell::Activate(bool bIsMDIActivate) if (bIsMDIActivate) { OutlinerView* pOutlinerView = mpNotesPanelView->GetOutlinerView(); - ::Outliner* pOutl = pOutlinerView->GetOutliner(); - pOutl->UpdateFields(); + ::Outliner& rOutl = pOutlinerView->GetOutliner(); + rOutl.UpdateFields(); } } @@ -1128,9 +1128,8 @@ void NotesPanelViewShell::FuTemporaryModify(SfxRequest& rReq) { pOutlinerView->SetAttribs(aSet); - ::Outliner* pOutliner = pOutlinerView->GetOutliner(); - if (pOutliner) - pOutliner->UpdateFields(); + ::Outliner& rOutliner = pOutlinerView->GetOutliner(); + rOutliner.UpdateFields(); } } } diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 6f37edc79e70..7847edd8a42c 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -2121,7 +2121,7 @@ void SdOutliner::Implementation::ProvideOutlinerView ( if (mpOutlineView == nullptr || !rOutliner.GetEditEngine().HasView(&mpOutlineView->GetEditView())) { delete mpOutlineView; - mpOutlineView = new OutlinerView(&rOutliner, pWindow); + mpOutlineView = new OutlinerView(rOutliner, pWindow); mbOwnOutlineView = true; bInsert = true; } diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx index 6ee22a9c457a..5bf9cddb74e7 100644 --- a/sd/source/ui/view/drawview.cxx +++ b/sd/source/ui/view/drawview.cxx @@ -171,9 +171,9 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet, { // Presentation object outline OutlinerView* pOV = GetTextEditOutlinerView(); - ::Outliner* pOutliner = pOV->GetOutliner(); + ::Outliner& rOutliner = pOV->GetOutliner(); - pOutliner->SetUpdateLayout(false); + rOutliner.SetUpdateLayout(false); mpDocSh->SetWaitCursor( true ); // replace placeholder by template name @@ -189,8 +189,8 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet, while (pPara) { - sal_Int32 nParaPos = pOutliner->GetAbsPos( pPara ); - sal_Int16 nDepth = pOutliner->GetDepth( nParaPos ); + sal_Int32 nParaPos = rOutliner.GetAbsPos( pPara ); + sal_Int16 nDepth = rOutliner.GetDepth( nParaPos ); OUString aName = rPage.GetLayoutName() + " " + OUString::number((nDepth <= 0) ? 1 : nDepth + 1); SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pStShPool->Find(aName, SfxStyleFamily::Page)); @@ -242,13 +242,13 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet, iter = aSelList.rend(); --iter; - if (pOutliner->GetDepth(pOutliner->GetAbsPos(*iter)) > 0) - pPara = pOutliner->GetParagraph( 0 ); // Put NumBulletItem in outline level 1 + if (rOutliner.GetDepth(rOutliner.GetAbsPos(*iter)) > 0) + pPara = rOutliner.GetParagraph( 0 ); // Put NumBulletItem in outline level 1 } } mpDocSh->SetWaitCursor( false ); - pOV->GetOutliner()->SetUpdateLayout(true); + pOV->GetOutliner().SetUpdateLayout(true); mpDocSh->GetUndoManager()->LeaveListAction(); diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 93c407510f71..de14496da243 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -272,21 +272,21 @@ void TextObjectBar::GetAttrStateImpl(ViewShell& rViewShell, ::sd::View* pView, S if (pOLV) { // Outliner at outline-mode - ::Outliner* pOutl = pOLV->GetOutliner(); + ::Outliner& rOutl = pOLV->GetOutliner(); std::vector<Paragraph*> aSelList; pOLV->CreateSelectionList(aSelList); Paragraph* pPara = aSelList.empty() ? nullptr : *(aSelList.begin()); // find out if we are an OutlineView - bool bIsOutlineView(OutlinerMode::OutlineView == pOLV->GetOutliner()->GetOutlinerMode()); + bool bIsOutlineView(OutlinerMode::OutlineView == pOLV->GetOutliner().GetOutlinerMode()); // This is ONLY for OutlineViews if(bIsOutlineView) { // allow move up if position is 2 or greater OR it // is a title object (and thus depth==1) - if(pOutl->GetAbsPos(pPara) > 1 || ( ::Outliner::HasParaFlag(pPara,ParaFlag::ISPAGE) && pOutl->GetAbsPos(pPara) > 0 ) ) + if(rOutl.GetAbsPos(pPara) > 1 || ( ::Outliner::HasParaFlag(pPara,ParaFlag::ISPAGE) && rOutl.GetAbsPos(pPara) > 0 ) ) { // not at top bDisableUp = false; @@ -295,7 +295,7 @@ void TextObjectBar::GetAttrStateImpl(ViewShell& rViewShell, ::sd::View* pView, S else { // old behaviour for OutlinerMode::OutlineObject - if(pOutl->GetAbsPos(pPara) > 0) + if(rOutl.GetAbsPos(pPara) > 0) { // not at top bDisableUp = false; @@ -306,7 +306,7 @@ void TextObjectBar::GetAttrStateImpl(ViewShell& rViewShell, ::sd::View* pView, S { pPara = rpItem; - sal_Int16 nDepth = pOutl->GetDepth( pOutl->GetAbsPos( pPara ) ); + sal_Int16 nDepth = rOutl.GetDepth( rOutl.GetAbsPos( pPara ) ); if (nDepth > 0 || (bOutlineViewSh && (nDepth <= 0) && !::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE )) ) { @@ -314,16 +314,16 @@ void TextObjectBar::GetAttrStateImpl(ViewShell& rViewShell, ::sd::View* pView, S bDisableLeft = false; } - if( (nDepth < pOLV->GetOutliner()->GetMaxDepth() && ( !bOutlineViewSh || pOutl->GetAbsPos(pPara) != 0 )) || - (bOutlineViewSh && (nDepth <= 0) && ::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) && pOutl->GetAbsPos(pPara) != 0) ) + if( (nDepth < pOLV->GetOutliner().GetMaxDepth() && ( !bOutlineViewSh || rOutl.GetAbsPos(pPara) != 0 )) || + (bOutlineViewSh && (nDepth <= 0) && ::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) && rOutl.GetAbsPos(pPara) != 0) ) { // not maximum depth and not at top bDisableRight = false; } } - if ( ( pOutl->GetAbsPos(pPara) < pOutl->GetParagraphCount() - 1 ) && - ( pOutl->GetParagraphCount() > 1 || !bOutlineViewSh) ) + if ( ( rOutl.GetAbsPos(pPara) < rOutl.GetParagraphCount() - 1 ) && + ( rOutl.GetParagraphCount() > 1 || !bOutlineViewSh) ) { // not last paragraph bDisableDown = false; @@ -334,9 +334,9 @@ void TextObjectBar::GetAttrStateImpl(ViewShell& rViewShell, ::sd::View* pView, S if(!bDisableDown && bIsOutlineView && pPara - && 0 == pOutl->GetAbsPos(pPara) - && pOutl->GetParagraphCount() > 1 - && !::Outliner::HasParaFlag( pOutl->GetParagraph(1), ParaFlag::ISPAGE ) ) + && 0 == rOutl.GetAbsPos(pPara) + && rOutl.GetParagraphCount() > 1 + && !::Outliner::HasParaFlag( rOutl.GetParagraph(1), ParaFlag::ISPAGE ) ) { // Needs to be disabled bDisableDown = true; @@ -528,13 +528,13 @@ void TextObjectBar::GetAttrStateImpl(ViewShell& rViewShell, ::sd::View* pView, S if( !aSel.HasRange() ) { nStartPara = 0; - nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1; + nEndPara = pOLV->GetOutliner().GetParagraphCount() - 1; } ::tools::Long nUpper = 0; for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ ) { - const SfxItemSet& rItems = pOLV->GetOutliner()->GetParaAttribs( nPara ); + const SfxItemSet& rItems = pOLV->GetOutliner().GetParaAttribs( nPara ); const SvxULSpaceItem& rItem = rItems.Get( EE_PARA_ULSPACE ); nUpper = std::max( nUpper, static_cast<::tools::Long>(rItem.GetUpper()) ); } diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 63ead9b89385..bd0492b96d30 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -134,19 +134,17 @@ void TextObjectBar::Execute(SfxRequest& rReq) if( !aSel.HasRange() ) { nStartPara = 0; - nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1; + nEndPara = pOLV->GetOutliner().GetParagraphCount() - 1; } - pOLV->GetOutliner()->UndoActionStart( OLUNDO_ATTR ); + pOLV->GetOutliner().UndoActionStart( OLUNDO_ATTR ); for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ ) { - SfxStyleSheet* pStyleSheet = nullptr; - if (pOLV->GetOutliner() != nullptr) - pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara); + SfxStyleSheet* pStyleSheet = pOLV->GetOutliner().GetStyleSheet(nPara); if (pStyleSheet != nullptr) { SfxItemSet aAttr( pStyleSheet->GetItemSet() ); - SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( nPara ) ); + SfxItemSet aTmpSet( pOLV->GetOutliner().GetParaAttribs( nPara ) ); aAttr.Put( aTmpSet, false ); const SvxLRSpaceItem& rItem = aAttr.Get( EE_PARA_LRSPACE ); std::unique_ptr<SvxLRSpaceItem> pNewItem(rItem.Clone()); @@ -162,10 +160,10 @@ void TextObjectBar::Execute(SfxRequest& rReq) pNewItem->SetLeft(SvxIndentValue::twips(static_cast<sal_uInt16>(nLeft))); aAttr.Put( std::move(pNewItem) ); - pOLV->GetOutliner()->SetParaAttribs( nPara, aAttr ); + pOLV->GetOutliner().SetParaAttribs( nPara, aAttr ); } } - pOLV->GetOutliner()->UndoActionEnd(); + pOLV->GetOutliner().UndoActionEnd(); mrViewShell.Invalidate( SID_UNDO ); } rReq.Done(); @@ -189,19 +187,17 @@ void TextObjectBar::Execute(SfxRequest& rReq) if( !aSel.HasRange() ) { nStartPara = 0; - nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1; + nEndPara = pOLV->GetOutliner().GetParagraphCount() - 1; } - pOLV->GetOutliner()->UndoActionStart( OLUNDO_ATTR ); + pOLV->GetOutliner().UndoActionStart( OLUNDO_ATTR ); for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ ) { - SfxStyleSheet* pStyleSheet = nullptr; - if (pOLV->GetOutliner() != nullptr) - pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara); + SfxStyleSheet* pStyleSheet = pOLV->GetOutliner().GetStyleSheet(nPara); if (pStyleSheet != nullptr) { SfxItemSet aAttr( pStyleSheet->GetItemSet() ); - SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( nPara ) ); + SfxItemSet aTmpSet( pOLV->GetOutliner().GetParaAttribs( nPara ) ); aAttr.Put( aTmpSet, false ); // sal_False= InvalidItems is not default, handle it as "holes" const SvxULSpaceItem& rItem = aAttr.Get( EE_PARA_ULSPACE ); std::unique_ptr<SvxULSpaceItem> pNewItem(rItem.Clone()); @@ -228,10 +224,10 @@ void TextObjectBar::Execute(SfxRequest& rReq) SfxItemSet aNewAttrs(std::move(aAttr)); aNewAttrs.Put( std::move(pNewItem) ); - pOLV->GetOutliner()->SetParaAttribs( nPara, aNewAttrs ); + pOLV->GetOutliner().SetParaAttribs( nPara, aNewAttrs ); } } - pOLV->GetOutliner()->UndoActionEnd(); + pOLV->GetOutliner().UndoActionEnd(); mrViewShell.Invalidate( SID_UNDO ); } else @@ -419,47 +415,44 @@ void TextObjectBar::Execute(SfxRequest& rReq) //effectively a preview of the equivalent style level, and //changing the level disconnects it from the style - ::Outliner* pOL = pOLV->GetOutliner(); - if (pOL) + ::Outliner& rOL = pOLV->GetOutliner(); + const SvxNumBulletItem *pItem = nullptr; + SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool(); + OUString sStyleName(SdResId(STR_PSEUDOSHEET_OUTLINE) + " 1"); + SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find(sStyleName, SfxStyleFamily::Pseudo); + if( pFirstStyleSheet ) + pItem = pFirstStyleSheet->GetItemSet().GetItemIfSet(EE_PARA_NUMBULLET, false); + + if (pItem ) { - const SvxNumBulletItem *pItem = nullptr; - SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool(); - OUString sStyleName(SdResId(STR_PSEUDOSHEET_OUTLINE) + " 1"); - SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find(sStyleName, SfxStyleFamily::Pseudo); - if( pFirstStyleSheet ) - pItem = pFirstStyleSheet->GetItemSet().GetItemIfSet(EE_PARA_NUMBULLET, false); - - if (pItem ) + SvxNumRule aNewRule(pItem->GetNumRule()); + ESelection aSel = pOLV->GetSelection(); + aSel.Adjust(); + sal_Int32 nStartPara = aSel.start.nPara; + sal_Int32 nEndPara = aSel.end.nPara; + for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara) { - SvxNumRule aNewRule(pItem->GetNumRule()); - ESelection aSel = pOLV->GetSelection(); - aSel.Adjust(); - sal_Int32 nStartPara = aSel.start.nPara; - sal_Int32 nEndPara = aSel.end.nPara; - for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara) + sal_uInt16 nLevel = rOL.GetDepth(nPara); + SvxNumberFormat aFmt(aNewRule.GetLevel(nLevel)); + + if (aFmt.GetNumberingType() == SVX_NUM_NUMBER_NONE) { - sal_uInt16 nLevel = pOL->GetDepth(nPara); - SvxNumberFormat aFmt(aNewRule.GetLevel(nLevel)); - - if (aFmt.GetNumberingType() == SVX_NUM_NUMBER_NONE) - { - aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); - SdStyleSheetPool::setDefaultOutlineNumberFormatBulletAndIndent(nLevel, aFmt); - } - else - { - aFmt.SetNumberingType(SVX_NUM_NUMBER_NONE); - aFmt.SetAbsLSpace(0); - aFmt.SetFirstLineOffset(0); - } - - aNewRule.SetLevel(nLevel, aFmt); + aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); + SdStyleSheetPool::setDefaultOutlineNumberFormatBulletAndIndent(nLevel, aFmt); + } + else + { + aFmt.SetNumberingType(SVX_NUM_NUMBER_NONE); + aFmt.SetAbsLSpace(0); + aFmt.SetFirstLineOffset(0); } - pFirstStyleSheet->GetItemSet().Put(SvxNumBulletItem(std::move(aNewRule), EE_PARA_NUMBULLET)); - - SdStyleSheet::BroadcastSdStyleSheetChange(pFirstStyleSheet, PresentationObjects::Outline_1, pSSPool); + aNewRule.SetLevel(nLevel, aFmt); } + + pFirstStyleSheet->GetItemSet().Put(SvxNumBulletItem(std::move(aNewRule), EE_PARA_NUMBULLET)); + + SdStyleSheet::BroadcastSdStyleSheetChange(pFirstStyleSheet, PresentationObjects::Outline_1, pSSPool); } } SfxBindings& rBindings = mrViewShell.GetViewFrame()->GetBindings(); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index ddb81a886407..a01c2b135960 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -3197,9 +3197,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { pOLV->SetAttribs( aSet ); - ::Outliner* pOutliner = pOLV->GetOutliner(); - if( pOutliner ) - pOutliner->UpdateFields(); + ::Outliner& rOutliner = pOLV->GetOutliner(); + rOutliner.UpdateFields(); } if(pField) diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 764eef122571..f459695aa576 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -600,11 +600,8 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) LanguageType eLanguage( LANGUAGE_SYSTEM ); // Format popup with outliner language, if possible - if( pOLV->GetOutliner() ) - { - ESelection aSelection( pOLV->GetSelection() ); - eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.start.nPara, aSelection.start.nIndex ); - } + ESelection aSelection( pOLV->GetSelection() ); + eLanguage = pOLV->GetOutliner().GetLanguage( aSelection.start.nPara, aSelection.start.nIndex ); //fdo#44998 if the outliner has captured the mouse events release the lock //so the SdFieldPopup can get them diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index e56f3f6da9d0..902c9d5e431f 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -238,12 +238,12 @@ void DrawViewShell::GetDrawAttrState(SfxItemSet& rSet) return nullptr; OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView(); - ::Outliner* pOL = pOLV ? pOLV->GetOutliner() : nullptr; - if (!pOL) + if (!pOLV) return nullptr; + ::Outliner& rOL = pOLV->GetOutliner(); rSel = pOLV->GetSelection(); - return pOL; + return &rOL; } void DrawViewShell::GetMarginProperties( SfxItemSet &rSet ) diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index fe782496984b..c1dd1e8a65a9 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -201,8 +201,8 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq) case SID_OUTLINE_FORMAT: { - ::Outliner* pOutl = pOutlinerView->GetOutliner(); - pOutl->SetFlatMode( !pOutl->IsFlatMode() ); + ::Outliner& rOutl = pOutlinerView->GetOutliner(); + rOutl.SetFlatMode( !rOutl.IsFlatMode() ); Invalidate( SID_COLORVIEW ); Cancel(); rReq.Done(); @@ -234,18 +234,18 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq) case SID_COLORVIEW: { - ::Outliner* pOutl = pOutlinerView->GetOutliner(); - EEControlBits nCntrl = pOutl->GetControlWord(); + ::Outliner& rOutl = pOutlinerView->GetOutliner(); + EEControlBits nCntrl = rOutl.GetControlWord(); if ( !(nCntrl & EEControlBits::NOCOLORS) ) { // color view is enabled: disable - pOutl->SetControlWord(nCntrl | EEControlBits::NOCOLORS); + rOutl.SetControlWord(nCntrl | EEControlBits::NOCOLORS); } else { // color view is disabled: enable - pOutl->SetControlWord(nCntrl & ~EEControlBits::NOCOLORS); + rOutl.SetControlWord(nCntrl & ~EEControlBits::NOCOLORS); } InvalidateWindows(); @@ -594,9 +594,8 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) { pOutlinerView->SetAttribs( aSet ); - ::Outliner* pOutliner = pOutlinerView->GetOutliner(); - if( pOutliner ) - pOutliner->UpdateFields(); + ::Outliner& rOutliner = pOutlinerView->GetOutliner(); + rOutliner.UpdateFields(); } } } diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index fba78ecd55b6..097f11028efd 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -324,8 +324,8 @@ void OutlineViewShell::Activate( bool bIsMDIActivate ) if( bIsMDIActivate ) { OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() ); - ::Outliner* pOutl = pOutlinerView->GetOutliner(); - pOutl->UpdateFields(); + ::Outliner& rOutl = pOutlinerView->GetOutliner(); + rOutl.UpdateFields(); } } diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 40b81ad3c95c..d095eb030d2f 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -100,7 +100,7 @@ OutlineView::OutlineView(DrawDocShell& rDocSh, vcl::Window* pWindow, mnPaperWidth = 19000; } - mpOutlinerViews[0].reset( new OutlinerView(&mrOutliner, pWindow) ); + mpOutlinerViews[0].reset( new OutlinerView(mrOutliner, pWindow) ); mpOutlinerViews[0]->SetOutputArea(::tools::Rectangle()); mrOutliner.SetUpdateLayout(false); mrOutliner.InsertView(mpOutlinerViews[0].get(), EE_APPEND); @@ -210,7 +210,7 @@ void OutlineView::AddDeviceToPaintView(OutputDevice& rDev, vcl::Window* pWindow) { if (mpOutlinerViews[nView] == nullptr) { - mpOutlinerViews[nView].reset( new OutlinerView(&mrOutliner, dynamic_cast< ::sd::Window* >(rDev.GetOwnerWindow())) ); + mpOutlinerViews[nView].reset( new OutlinerView(mrOutliner, dynamic_cast< ::sd::Window* >(rDev.GetOwnerWindow())) ); mpOutlinerViews[nView]->SetBackgroundColor( aWhiteColor ); mrOutliner.InsertView(mpOutlinerViews[nView].get(), EE_APPEND); bAdded = true; diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 75faa6dae553..bfa2202e13cf 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -1277,7 +1277,7 @@ void View::ChangeMarkedObjectsBulletsNumbering( const bool bToggleOn = ShouldToggleOn( bToggle, bHandleBullets ); std::unique_ptr<SdrOutliner> pOutliner(SdrMakeOutliner(OutlinerMode::TextObject, rSdrModel)); - OutlinerView aOutlinerView(pOutliner.get(), pWindow); + OutlinerView aOutlinerView(*pOutliner, pWindow); const SdrMarkList& rMarkList = GetMarkedObjectList(); const size_t nMarkCount = rMarkList.GetMarkCount(); diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 7fd8970d4142..bb771e5c6149 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -289,37 +289,34 @@ void View::DoPaste (::sd::Window* pWindow,bool /*bMergeMasterPagesOnly*/) SdrObject* pObj = GetTextEditObject(); SdPage* pPage = static_cast<SdPage*>( pObj ? pObj->getSdrPageFromSdrObject() : nullptr ); - ::Outliner* pOutliner = pOLV->GetOutliner(); + ::Outliner& rOutliner = pOLV->GetOutliner(); - if( pOutliner) + if( pObj && pPage && pPage->GetPresObjKind(pObj) == PresObjKind::Title ) { - if( pObj && pPage && pPage->GetPresObjKind(pObj) == PresObjKind::Title ) + // remove all hard linebreaks from the title + if (rOutliner.GetParagraphCount() > 1) { - // remove all hard linebreaks from the title - if (pOutliner->GetParagraphCount() > 1) - { - bool bOldUpdateMode = pOutliner->SetUpdateLayout( false ); + bool bOldUpdateMode = rOutliner.SetUpdateLayout( false ); - const EditEngine& rEdit = pOutliner->GetEditEngine(); - const sal_Int32 nParaCount = rEdit.GetParagraphCount(); + const EditEngine& rEdit = rOutliner.GetEditEngine(); + const sal_Int32 nParaCount = rEdit.GetParagraphCount(); - for( sal_Int32 nPara = nParaCount - 2; nPara >= 0; nPara-- ) - { - const sal_Int32 nParaLen = rEdit.GetTextLen( nPara ); - pOutliner->QuickInsertLineBreak(ESelection(nPara, nParaLen, nPara + 1, 0)); - } - - DBG_ASSERT( rEdit.GetParagraphCount() <= 1, "Titleobject contains hard line breaks" ); - pOutliner->SetUpdateLayout(bOldUpdateMode); + for( sal_Int32 nPara = nParaCount - 2; nPara >= 0; nPara-- ) + { + const sal_Int32 nParaLen = rEdit.GetTextLen( nPara ); + rOutliner.QuickInsertLineBreak(ESelection(nPara, nParaLen, nPara + 1, 0)); } - } - if( !mrDoc.IsChanged() ) - { - if (pOutliner->IsModified()) - mrDoc.SetChanged(); + DBG_ASSERT( rEdit.GetParagraphCount() <= 1, "Titleobject contains hard line breaks" ); + rOutliner.SetUpdateLayout(bOldUpdateMode); } } + + if( !mrDoc.IsChanged() ) + { + if (rOutliner.IsModified()) + mrDoc.SetChanged(); + } } else { diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 5598e4ce4279..3fd2c4a345cb 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -754,7 +754,7 @@ void TextEditOverlayObject::checkDataChange(const basegfx::B2DRange& rMinTextEdi } // check if text primitives did change - SdrOutliner* pSdrOutliner = dynamic_cast<SdrOutliner*>(getOutlinerView().GetOutliner()); + SdrOutliner* pSdrOutliner = dynamic_cast<SdrOutliner*>(&getOutlinerView().GetOutliner()); if (pSdrOutliner) { @@ -987,7 +987,7 @@ void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const tools:: if (!comphelper::LibreOfficeKit::isActive() || !rRect.IsEmpty()) aBlankRect.Intersection(rRect); - rOutlView.GetOutliner()->SetUpdateLayout(true); // Bugfix #22596# + rOutlView.GetOutliner().SetUpdateLayout(true); // Bugfix #22596# rOutlView.Paint(aBlankRect, &rTargetDevice); if (!bModified) @@ -1090,7 +1090,7 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, OutlinerVie if (pOutlView == nullptr) { - pOutlView = new OutlinerView(mpTextEditOutliner.get(), pWin); + pOutlView = new OutlinerView(*mpTextEditOutliner, pWin); } else { @@ -2528,8 +2528,8 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) } mpTextEditOutlinerView->SetAttribs(rSet); - Outliner* pTEOutliner = mpTextEditOutlinerView->GetOutliner(); - if (pTEOutliner && pTEOutliner->IsModified()) + const Outliner& rTEOutliner = mpTextEditOutlinerView->GetOutliner(); + if (rTEOutliner.IsModified()) { GetModel().SetChanged(); SetInnerTextAreaForLOKit(); @@ -2575,13 +2575,11 @@ void SdrObjEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveH // on all paragraphs in the Outliner for the edit view if (nullptr != mpTextEditOutlinerView) { - Outliner* pOutliner = mpTextEditOutlinerView->GetOutliner(); + Outliner& rOutliner = mpTextEditOutlinerView->GetOutliner(); - const sal_Int32 nParaCount = pOutliner->GetParagraphCount(); + const sal_Int32 nParaCount = rOutliner.GetParagraphCount(); for (sal_Int32 nPara = 0; nPara < nParaCount; nPara++) - { - pOutliner->SetStyleSheet(nPara, pStyleSheet); - } + rOutliner.SetStyleSheet(nPara, pStyleSheet); } SdrGlueEditView::SetStyleSheet(pStyleSheet, bDontRemoveHardAttr); @@ -3094,28 +3092,24 @@ void SdrObjEditView::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, sal_Int16 nDe } else { - ::Outliner* pOutliner = pOLV->GetOutliner(); - if (pOutliner) + ::Outliner& rOutliner = pOLV->GetOutliner(); + const EditEngine& rEditEngine = rOutliner.GetEditEngine(); + + ESelection aSel(pOLV->GetSelection()); + bool fullParaSelection + = aSel.end.nPara != aSel.start.nPara || pOLV->GetEditView().IsSelectionFullPara(); + if (!aSel.HasRange()) + pOLV->SetSelection(rEditEngine.GetWord(aSel, css::i18n::WordType::DICTIONARY_WORD)); + const bool bRemoveParaAttribs = !bNoParagraphFormats && !fullParaSelection; + pOLV->RemoveAttribsKeepLanguages(bRemoveParaAttribs); + SfxItemSet aSet(pOLV->GetAttribs()); + SfxItemSet aPaintSet(CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, + aSet, bNoCharacterFormats, bNoParagraphFormats)); + pOLV->SetAttribs(aPaintSet); + if (!bNoParagraphFormats && nDepth > -2) { - const EditEngine& rEditEngine = pOutliner->GetEditEngine(); - - ESelection aSel(pOLV->GetSelection()); - bool fullParaSelection - = aSel.end.nPara != aSel.start.nPara || pOLV->GetEditView().IsSelectionFullPara(); - if (!aSel.HasRange()) - pOLV->SetSelection(rEditEngine.GetWord(aSel, css::i18n::WordType::DICTIONARY_WORD)); - const bool bRemoveParaAttribs = !bNoParagraphFormats && !fullParaSelection; - pOLV->RemoveAttribsKeepLanguages(bRemoveParaAttribs); - SfxItemSet aSet(pOLV->GetAttribs()); - SfxItemSet aPaintSet(CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(), - rFormatSet, aSet, bNoCharacterFormats, - bNoParagraphFormats)); - pOLV->SetAttribs(aPaintSet); - if (!bNoParagraphFormats && nDepth > -2) - { - for (sal_Int32 nPara = aSel.start.nPara; nPara <= aSel.end.nPara; ++nPara) - pOLV->SetDepth(nPara, nDepth); - } + for (sal_Int32 nPara = aSel.start.nPara; nPara <= aSel.end.nPara; ++nPara) + pOLV->SetDepth(nPara, nDepth); } } diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 65c96385f0e6..97ff72af1290 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -759,8 +759,8 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh) aTmpOutliner.SetPaperSize( pTextObj->GetLogicRect().GetSize() ); aTmpOutliner.SetSpeller( xSpell ); - OutlinerView aOutlView( &aTmpOutliner, &(rView.GetEditWin()) ); - aOutlView.GetOutliner()->SetRefDevice( rSh.getIDocumentDeviceAccess().getPrinter( false ) ); + OutlinerView aOutlView( aTmpOutliner, &(rView.GetEditWin()) ); + aOutlView.GetOutliner().SetRefDevice( rSh.getIDocumentDeviceAccess().getPrinter( false ) ); aTmpOutliner.InsertView( &aOutlView ); Size aSize(1,1); tools::Rectangle aRect( Point(), aSize ); diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 4560672bb304..4f2200896d75 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -341,7 +341,7 @@ void SwAnnotationWin::InitControls() aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner.get() ); mpOutliner->SetUpdateLayout( true ); - mpOutlinerView.reset(new OutlinerView(mpOutliner.get(), nullptr)); + mpOutlinerView.reset(new OutlinerView(*mpOutliner, nullptr)); mpOutliner->InsertView(mpOutlinerView.get()); //create Scrollbars diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 41cdeb207a85..237c6bc0fb46 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -1927,13 +1927,10 @@ void SwPostItMgr::FormatAll(const SfxItemSet &rNewAttr) //save old selection ESelection aOrigSel(pOLV->GetSelection()); //select all - Outliner *pOutliner = pOLV->GetOutliner(); - if (pOutliner) - { - sal_Int32 nParaCount = pOutliner->GetParagraphCount(); - if (nParaCount > 0) - pOLV->SelectRange(0, nParaCount); - } + Outliner& rOutliner = pOLV->GetOutliner(); + sal_Int32 nParaCount = rOutliner.GetParagraphCount(); + if (nParaCount > 0) + pOLV->SelectRange(0, nParaCount); //set new char properties pOLV->SetAttribs(rNewAttr); //restore old selection diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index 079f6d3bb318..945bbecfd11a 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -233,7 +233,7 @@ void SidebarTextControl::DrawForPage(OutputDevice* pDev, const Point& rPt) if (OutlinerView* pOutlinerView = mrSidebarWin.GetOutlinerView()) { - pOutlinerView->GetOutliner()->Draw(*pDev, tools::Rectangle(rPt, aSize)); + pOutlinerView->GetOutliner().Draw(*pDev, tools::Rectangle(rPt, aSize)); } if ( mrSidebarWin.GetLayoutStatus()!=SwPostItHelper::DELETED ) diff --git a/sw/source/uibase/lingu/sdrhhcwrap.cxx b/sw/source/uibase/lingu/sdrhhcwrap.cxx index a8a705065606..1e30a00d0da7 100644 --- a/sw/source/uibase/lingu/sdrhhcwrap.cxx +++ b/sw/source/uibase/lingu/sdrhhcwrap.cxx @@ -60,8 +60,8 @@ SdrHHCWrapper::SdrHHCWrapper( SwView& rView, Size aSize( 1, 1 ); SetPaperSize( aSize ); - m_pOutlView.reset( new OutlinerView( this, &(m_rView.GetEditWin()) ) ); - m_pOutlView->GetOutliner()->SetRefDevice(m_rView.GetWrtShell().getIDocumentDeviceAccess().getPrinter( false )); + m_pOutlView.reset(new OutlinerView(*this, &(m_rView.GetEditWin()))); + m_pOutlView->GetOutliner().SetRefDevice(m_rView.GetWrtShell().getIDocumentDeviceAccess().getPrinter( false )); // Hack: all SdrTextObj attributes should be transferred to EditEngine m_pOutlView->SetBackgroundColor( COL_WHITE ); diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index ea30d7534854..4ffcc3081dee 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -151,7 +151,7 @@ SfxUndoManager* SwAnnotationShell::GetUndoManager() OSL_ENSURE(pPostItMgr,"PostItMgr::Layout(): We are looping forever"); return nullptr; } - return &pPostItMgr->GetActiveSidebarWin()->GetOutlinerView()->GetOutliner()->GetUndoManager(); + return &pPostItMgr->GetActiveSidebarWin()->GetOutlinerView()->GetOutliner().GetUndoManager(); } void SwAnnotationShell::Exec( SfxRequest &rReq ) @@ -359,13 +359,10 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) break; case SID_SELECTALL: { - Outliner * pOutliner = pOLV->GetOutliner(); - if(pOutliner) - { - sal_Int32 nParaCount = pOutliner->GetParagraphCount(); -e ... etc. - the rest is truncated