diff options
-rw-r--r-- | sw/inc/view.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view.cxx | 28 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view1.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewdraw.cxx | 18 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewling.cxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewmdi.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewport.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewsrch.cxx | 12 |
9 files changed, 46 insertions, 48 deletions
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index c8b03778acc2..eca967473ae6 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -166,7 +166,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell tools::Rectangle m_aVisArea; // visible region VclPtr<SwEditWin> m_pEditWin; - SwWrtShell *m_pWrtShell; + std::unique_ptr<SwWrtShell> m_pWrtShell; SfxShell *m_pShell; // current SubShell at the dispatcher FmFormShell *m_pFormShell; // DB-FormShell @@ -387,7 +387,7 @@ public: void StopShellTimer(); SwWrtShell& GetWrtShell () const { return *m_pWrtShell; } - SwWrtShell* GetWrtShellPtr() const { return m_pWrtShell; } + SwWrtShell* GetWrtShellPtr() const { return m_pWrtShell.get(); } SwEditWin &GetEditWin() { return *m_pEditWin; } const SwEditWin &GetEditWin () const { return *m_pEditWin; } diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index c67ae50f800d..8d5703a0bfcf 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -178,7 +178,7 @@ void SwView::GotFocus() const if ( pAsFormShell ) { pAsFormShell->ForgetActiveControl(); - const_cast< SwView* >( this )->AttrChangedNotify( m_pWrtShell ); + const_cast< SwView* >( this )->AttrChangedNotify( m_pWrtShell.get() ); } else if ( m_pPostItMgr ) { @@ -186,7 +186,7 @@ void SwView::GotFocus() const if ( pAsAnnotationShell ) { m_pPostItMgr->SetActiveSidebarWin(nullptr); - const_cast< SwView* >( this )->AttrChangedNotify( m_pWrtShell ); + const_cast< SwView* >( this )->AttrChangedNotify( m_pWrtShell.get() ); } } if( GetWrtShellPtr() ) @@ -215,7 +215,7 @@ IMPL_LINK_NOARG(SwView, FormControlActivated, LinkParamNone*, void) if ( pSdrView && pSdrView->IsTextEdit() ) pSdrView->SdrEndTextEdit( true ); - AttrChangedNotify( m_pWrtShell ); + AttrChangedNotify( m_pWrtShell.get() ); } } @@ -821,11 +821,11 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) SAL_INFO( "sw.ui", "before create WrtShell" ); if (SwView *pView = dynamic_cast<SwView*>(pExistingSh)) { - m_pWrtShell = new SwWrtShell(*pView->m_pWrtShell, m_pEditWin, *this); + m_pWrtShell.reset(new SwWrtShell(*pView->m_pWrtShell, m_pEditWin, *this)); } else if (SwWrtShell *pWrtShell = dynamic_cast<SwWrtShell*>(rDocSh.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell())) { - m_pWrtShell = new SwWrtShell(*pWrtShell, m_pEditWin, *this); + m_pWrtShell.reset(new SwWrtShell(*pWrtShell, m_pEditWin, *this)); } else { @@ -848,7 +848,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) aUsrPref.SetViewLayoutBookMode( false ); aUsrPref.SetViewLayoutColumns( 1 ); } - m_pWrtShell = new SwWrtShell( rDoc, m_pEditWin, *this, &aUsrPref ); + m_pWrtShell.reset(new SwWrtShell(rDoc, m_pEditWin, *this, &aUsrPref)); // creating an SwView from a SwPagePreview needs to // add the SwViewShell to the ring of the other SwViewShell(s) if(m_bOldShellWasPagePreview) @@ -873,7 +873,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) } } SAL_INFO( "sw.ui", "after create WrtShell" ); - m_pHRuler = VclPtr<SwCommentRuler>::Create(m_pWrtShell, &GetViewFrame()->GetWindow(), m_pEditWin, + m_pHRuler = VclPtr<SwCommentRuler>::Create(m_pWrtShell.get(), &GetViewFrame()->GetWindow(), m_pEditWin, SvxRulerSupportFlags::TABS | SvxRulerSupportFlags::PARAGRAPH_MARGINS | SvxRulerSupportFlags::BORDERS | @@ -970,7 +970,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) { if (m_pWrtShell->GetDoc()->GetDocumentFieldsManager().containsUpdatableFields()) { - SET_CURR_SHELL( m_pWrtShell ); + SET_CURR_SHELL(m_pWrtShell.get()); m_pWrtShell->StartAction(); m_pWrtShell->CalcLayout(); m_pWrtShell->GetDoc()->getIDocumentFieldsAccess().UpdateFields(false); @@ -1082,9 +1082,7 @@ SwView::~SwView() EndListening(*GetViewFrame()); EndListening(*GetDocShell()); m_pScrollFill.disposeAndClear(); - delete m_pWrtShell; - m_pWrtShell = nullptr; // Set to 0, so that it is not accessible by the following dtors cannot. - m_pShell = nullptr; + m_pWrtShell.reset(); // reset here so that it is not accessible by the following dtors. m_pHScrollbar.disposeAndClear(); m_pVScrollbar.disposeAndClear(); m_pHRuler.disposeAndClear(); @@ -1164,7 +1162,7 @@ void SwView::ReadUserData( const OUString &rUserData, bool bBrowse ) { bool bIsOwnDocument = lcl_IsOwnDocument( *this ); - SET_CURR_SHELL(m_pWrtShell); + SET_CURR_SHELL(m_pWrtShell.get()); sal_Int32 nPos = 0; @@ -1282,7 +1280,7 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue > if (!nLength) return; - SET_CURR_SHELL(m_pWrtShell); + SET_CURR_SHELL(m_pWrtShell.get()); const beans::PropertyValue *pValue = rSequence.getConstArray(); const SwRect& rRect = m_pWrtShell->GetCharRect(); const tools::Rectangle &rVis = GetVisArea(); @@ -1599,7 +1597,7 @@ OUString SwView::GetSelectionTextParam( bool bCompleteWrds, bool bEraseTrail ) SwGlossaryHdl* SwView::GetGlosHdl() { if(!m_pGlosHdl) - m_pGlosHdl = new SwGlossaryHdl(GetViewFrame(), m_pWrtShell); + m_pGlosHdl = new SwGlossaryHdl(GetViewFrame(), m_pWrtShell.get()); return m_pGlosHdl; } @@ -1614,7 +1612,7 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) GetDrawFuncPtr()->Deactivate(); SetDrawFuncPtr(nullptr); LeaveDrawCreate(); - AttrChangedNotify(m_pWrtShell); + AttrChangedNotify(m_pWrtShell.get()); } } else diff --git a/sw/source/uibase/uiview/view1.cxx b/sw/source/uibase/uiview/view1.cxx index 6c6ab090f989..404b2e726bf9 100644 --- a/sw/source/uibase/uiview/view1.cxx +++ b/sw/source/uibase/uiview/view1.cxx @@ -103,7 +103,7 @@ void SwView::Activate(bool bMDIActivate) m_sSwViewData.clear(); } - AttrChangedNotify(m_pWrtShell); + AttrChangedNotify(m_pWrtShell.get()); // Initialize Fielddlg newly if necessary (e.g. for TYP_SETVAR) sal_uInt16 nId = SwFieldDlgWrapper::GetChildWindowId(); @@ -133,7 +133,7 @@ void SwView::Activate(bool bMDIActivate) } else // At least call the Notify (as a precaution because of the SlotFilter). - AttrChangedNotify(m_pWrtShell); + AttrChangedNotify(m_pWrtShell.get()); SfxViewShell::Activate(bMDIActivate); } diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 4ef8b57ab786..90ca68a0f404 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -803,7 +803,7 @@ void SwView::Execute(SfxRequest &rReq) else if ( m_pWrtShell->IsDrawCreate() ) { GetDrawFuncPtr()->BreakCreate(); - AttrChangedNotify(m_pWrtShell); // shell change if needed + AttrChangedNotify(m_pWrtShell.get()); // shell change if needed } else if ( m_pWrtShell->HasSelection() || IsDrawMode() ) { @@ -825,7 +825,7 @@ void SwView::Execute(SfxRequest &rReq) rBind.Invalidate( SID_ATTR_SIZE ); } m_pWrtShell->EnterStdMode(); - AttrChangedNotify(m_pWrtShell); // shell change if necessary + AttrChangedNotify(m_pWrtShell.get()); // shell change if necessary } } else if ( GetEditWin().GetApplyTemplate() ) @@ -1854,7 +1854,7 @@ void SwView::InsFrameMode(sal_uInt16 nCols) { if ( m_pWrtShell->HasWholeTabSelection() ) { - SwFlyFrameAttrMgr aMgr( true, m_pWrtShell, Frmmgr_Type::TEXT ); + SwFlyFrameAttrMgr aMgr( true, m_pWrtShell.get(), Frmmgr_Type::TEXT ); const SwFrameFormat &rPageFormat = m_pWrtShell->GetPageDesc(m_pWrtShell->GetCurPageDesc()).GetMaster(); @@ -2157,7 +2157,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe if( aRef.is() && 1 < aRef->GetRefCount() ) // still a valid ref? { SwReader* pRdr; - Reader *pRead = pDocSh->StartConvertFrom( *pMedium, &pRdr, m_pWrtShell ); + Reader *pRead = pDocSh->StartConvertFrom(*pMedium, &pRdr, m_pWrtShell.get()); if( pRead || (pMedium->GetFilter()->GetFilterFlags() & SfxFilterFlags::STARONEFILTER) ) { diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index 208ce460db6b..3e6ef6324ec6 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -225,7 +225,7 @@ void SwView::ExecDraw(SfxRequest& rReq) m_pWrtShell->EnterSelFrameMode(); LeaveDrawCreate(); - AttrChangedNotify(m_pWrtShell); + AttrChangedNotify(m_pWrtShell.get()); return; } @@ -240,7 +240,7 @@ void SwView::ExecDraw(SfxRequest& rReq) { case SID_OBJECT_SELECT: case SID_DRAW_SELECT: - pFuncPtr = new DrawSelection(m_pWrtShell, m_pEditWin, this); + pFuncPtr = new DrawSelection(m_pWrtShell.get(), m_pEditWin, this); m_nDrawSfxId = m_nFormSfxId = SID_OBJECT_SELECT; m_sDrawCustom.clear(); break; @@ -262,7 +262,7 @@ void SwView::ExecDraw(SfxRequest& rReq) case SID_DRAW_TEXT_MARQUEE: case SID_DRAW_CAPTION: case SID_DRAW_CAPTION_VERTICAL: - pFuncPtr = new ConstRectangle(m_pWrtShell, m_pEditWin, this); + pFuncPtr = new ConstRectangle(m_pWrtShell.get(), m_pEditWin, this); m_nDrawSfxId = nSlotId; m_sDrawCustom.clear(); break; @@ -275,7 +275,7 @@ void SwView::ExecDraw(SfxRequest& rReq) case SID_DRAW_BEZIER_FILL: case SID_DRAW_FREELINE_NOFILL: case SID_DRAW_FREELINE: - pFuncPtr = new ConstPolygon(m_pWrtShell, m_pEditWin, this); + pFuncPtr = new ConstPolygon(m_pWrtShell.get(), m_pEditWin, this); m_nDrawSfxId = nSlotId; m_sDrawCustom.clear(); break; @@ -283,7 +283,7 @@ void SwView::ExecDraw(SfxRequest& rReq) case SID_DRAW_ARC: case SID_DRAW_PIE: case SID_DRAW_CIRCLECUT: - pFuncPtr = new ConstArc(m_pWrtShell, m_pEditWin, this); + pFuncPtr = new ConstArc(m_pWrtShell.get(), m_pEditWin, this); m_nDrawSfxId = nSlotId; m_sDrawCustom.clear(); break; @@ -293,7 +293,7 @@ void SwView::ExecDraw(SfxRequest& rReq) const SfxUInt16Item* pIdentifierItem = rReq.GetArg<SfxUInt16Item>(SID_FM_CONTROL_IDENTIFIER); if( pIdentifierItem ) nSlotId = pIdentifierItem->GetValue(); - pFuncPtr = new ConstFormControl(m_pWrtShell, m_pEditWin, this); + pFuncPtr = new ConstFormControl(m_pWrtShell.get(), m_pEditWin, this); m_nFormSfxId = nSlotId; } break; @@ -306,7 +306,7 @@ void SwView::ExecDraw(SfxRequest& rReq) case SID_DRAWTBX_CS_STAR : case SID_DRAW_CS_ID : { - pFuncPtr = new ConstCustomShape(m_pWrtShell, m_pEditWin, this, rReq ); + pFuncPtr = new ConstCustomShape(m_pWrtShell.get(), m_pEditWin, this, rReq ); m_nDrawSfxId = nSlotId; if ( nSlotId != SID_DRAW_CS_ID ) { @@ -337,7 +337,7 @@ void SwView::ExecDraw(SfxRequest& rReq) } SetDrawFuncPtr(pFuncPtr); - AttrChangedNotify(m_pWrtShell); + AttrChangedNotify(m_pWrtShell.get()); pFuncPtr->Activate(nSlotId); NoRotate(); @@ -376,7 +376,7 @@ void SwView::ExecDraw(SfxRequest& rReq) if(bEndTextEdit && pSdrView && pSdrView->IsTextEdit()) pSdrView->SdrEndTextEdit( true ); - AttrChangedNotify(m_pWrtShell); + AttrChangedNotify(m_pWrtShell.get()); } // End drawing diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index f7a1b91b1ebf..0f646e637c5e 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -242,7 +242,7 @@ void SwView::StartTextConversion( bool bOldIns = m_pWrtShell->IsInsMode(); m_pWrtShell->SetInsMode(); - const bool bSelection = static_cast<SwCursorShell*>(m_pWrtShell)->HasSelection() || + const bool bSelection = static_cast<SwCursorShell*>(m_pWrtShell.get())->HasSelection() || m_pWrtShell->GetCursor() != m_pWrtShell->GetCursor()->GetNext(); const bool bStart = bSelection || m_pWrtShell->IsStartOfDoc(); @@ -438,7 +438,7 @@ void SwView::HyphenateDocument() m_pWrtShell->StartUndo(SwUndoId::INSATTR); // valid later bool bHyphSpecial = xProp.is() && xProp->getIsHyphSpecial(); - bool bSelection = static_cast<SwCursorShell*>(m_pWrtShell)->HasSelection() || + bool bSelection = static_cast<SwCursorShell*>(m_pWrtShell.get())->HasSelection() || m_pWrtShell->GetCursor() != m_pWrtShell->GetCursor()->GetNext(); bool bOther = m_pWrtShell->HasOtherCnt() && bHyphSpecial && !bSelection; bool bStart = bSelection || ( !bOther && m_pWrtShell->IsStartOfDoc() ); @@ -478,7 +478,7 @@ bool SwView::IsValidSelectionForThesaurus() const // to be within a single paragraph const bool bMultiSel = m_pWrtShell->GetCursor()->IsMultiSelection(); - const bool bSelection = static_cast<SwCursorShell*>(m_pWrtShell)->HasSelection(); + const bool bSelection = static_cast<SwCursorShell*>(m_pWrtShell.get())->HasSelection(); return !bMultiSel && (!bSelection || m_pWrtShell->IsSelOnePara() ); } @@ -556,7 +556,7 @@ void SwView::StartThesaurus() comphelper::ScopeGuard guard([&]() { pVOpt->SetIdle(bOldIdle); }); // restore when leaving scope // get initial LookUp text - const bool bSelection = static_cast<SwCursorShell*>(m_pWrtShell)->HasSelection(); + const bool bSelection = static_cast<SwCursorShell*>(m_pWrtShell.get())->HasSelection(); OUString aTmp = GetThesaurusLookUpText( bSelection ); Reference< XThesaurus > xThes( ::GetThesaurus() ); @@ -639,7 +639,7 @@ bool SwView::ExecSpellPopup(const Point& rPt) m_pWrtShell->Push(); SwRect aToFill; - SwCursorShell *pCursorShell = static_cast<SwCursorShell*>(m_pWrtShell); + SwCursorShell *pCursorShell = static_cast<SwCursorShell*>(m_pWrtShell.get()); SwPaM *pCursor = pCursorShell->GetCursor(); SwPosition aPoint(*pCursor->GetPoint()); const SwTextNode *pNode = aPoint.nNode.GetNode().GetTextNode(); @@ -700,8 +700,8 @@ bool SwView::ExecSpellPopup(const Point& rPt) bRet = true; m_pWrtShell->SttSelect(); std::unique_ptr<SwSpellPopup> xPopup(bUseGrammarContext ? - new SwSpellPopup(m_pWrtShell, aGrammarCheckRes, nErrorInResult, aSuggestions, aParaText) : - new SwSpellPopup(m_pWrtShell, xAlt, aParaText)); + new SwSpellPopup(m_pWrtShell.get(), aGrammarCheckRes, nErrorInResult, aSuggestions, aParaText) : + new SwSpellPopup(m_pWrtShell.get(), xAlt, aParaText)); ui::ContextMenuExecuteEvent aEvent; const Point aPixPos = GetEditWin().LogicToPixel( rPt ); diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index 08af720f9e4a..b4124d268c5f 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -73,7 +73,7 @@ void SwView::SetZoom_( const Size &rEditSize, SvxZoomType eZoomType, m_pWrtShell->LockPaint(); { // start of SwActContext scope - SwActContext aActContext(m_pWrtShell); + SwActContext aActContext(m_pWrtShell.get()); long nFac = nFactor; @@ -210,7 +210,7 @@ void SwView::SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly { - SwActContext aActContext(m_pWrtShell); + SwActContext aActContext(m_pWrtShell.get()); if ( !GetViewFrame()->GetFrame().IsInPlace() && !bViewOnly ) { diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 75e38086eec7..96ae9c630c60 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -1075,7 +1075,7 @@ void SwView::OuterResizePixel( const Point &rOfst, const Size &rSize ) ShowVScrollbar(bShowV); m_pVScrollbar->SetAuto(bAuto); - SET_CURR_SHELL( m_pWrtShell ); + SET_CURR_SHELL( m_pWrtShell.get() ); bool bRepeat = false; long nCnt = 0; diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index 34527806aca8..63db8729b759 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -242,7 +242,7 @@ void SwView::ExecSearch(SfxRequest& rReq) { Scroll(m_pWrtShell->GetCharRect().SVRect()); if (comphelper::LibreOfficeKit::isActive()) - lcl_emitSearchResultCallbacks(m_pSrchItem, m_pWrtShell, /* bHighlightAll = */ false); + lcl_emitSearchResultCallbacks(m_pSrchItem, m_pWrtShell.get(), /* bHighlightAll = */ false); } rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); #if HAVE_FEATURE_DESKTOP @@ -276,7 +276,7 @@ void SwView::ExecSearch(SfxRequest& rReq) m_bFound = false; } else if (comphelper::LibreOfficeKit::isActive()) - lcl_emitSearchResultCallbacks(m_pSrchItem, m_pWrtShell, /* bHighlightAll = */ true); + lcl_emitSearchResultCallbacks(m_pSrchItem, m_pWrtShell.get(), /* bHighlightAll = */ true); rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); #if HAVE_FEATURE_DESKTOP { @@ -350,7 +350,7 @@ void SwView::ExecSearch(SfxRequest& rReq) case SvxSearchCmd::REPLACE_ALL: { - SwSearchOptions aOpts( m_pWrtShell, m_pSrchItem->GetBackward() ); + SwSearchOptions aOpts( m_pWrtShell.get(), m_pSrchItem->GetBackward() ); m_bExtra = false; sal_uLong nFound; @@ -505,7 +505,7 @@ void SwView::ExecSearch(SfxRequest& rReq) bool SwView::SearchAndWrap(bool bApi) { - SwSearchOptions aOpts( m_pWrtShell, m_pSrchItem->GetBackward() ); + SwSearchOptions aOpts( m_pWrtShell.get(), m_pSrchItem->GetBackward() ); // Remember starting position of the search for wraparound // Start- / EndAction perhaps because existing selections of 'search all' @@ -648,7 +648,7 @@ bool SwView::SearchAll() SwWait aWait( *GetDocShell(), true ); m_pWrtShell->StartAllAction(); - SwSearchOptions aOpts( m_pWrtShell, m_pSrchItem->GetBackward() ); + SwSearchOptions aOpts( m_pWrtShell.get(), m_pSrchItem->GetBackward() ); if (!m_pSrchItem->GetSelection()) { @@ -710,7 +710,7 @@ void SwView::Replace() m_pSrchItem->SetSelection(true); //check if it matches - SwSearchOptions aOpts( m_pWrtShell, m_pSrchItem->GetBackward() ); + SwSearchOptions aOpts( m_pWrtShell.get(), m_pSrchItem->GetBackward() ); if( ! FUNC_Search(aOpts) ) { |