diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-02-16 10:42:06 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-02-16 15:13:21 +0000 |
commit | 0908c7c1184ab7acb7b6f6740a82c2f12c296fae (patch) | |
tree | 7bfe09dce871f6f2bc59a81b689d7ab5a3a6f3ea /sc/source/ui/drawfunc | |
parent | e71080e19365aa074c56d1136dad2b09783949a2 (diff) |
SfxViewShell::GetViewFrame never returns null, change to a reference
various null checks can be seen to be redundant and removed
Change-Id: Icf49c1de4b0302795d2769a370af3abceaad0221
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147147
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/drawfunc')
-rw-r--r-- | sc/source/ui/drawfunc/drawsh.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drawsh2.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drawsh5.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob2.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fudraw.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fuins1.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fuins2.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fusel.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/futext.cxx | 10 |
10 files changed, 28 insertions, 28 deletions
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index 568218da662b..d5f50377a8a8 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -127,7 +127,7 @@ void ScDrawShell::setModified() static void lcl_invalidateTransformAttr(const ScTabViewShell* pViewShell) { - SfxBindings& rBindings=pViewShell->GetViewFrame()->GetBindings(); + SfxBindings& rBindings=pViewShell->GetViewFrame().GetBindings(); rBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH); rBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT); rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X); @@ -432,7 +432,7 @@ void ScDrawShell::ExecuteMacroAssign(SdrObject* pObj, weld::Window* pWin) css::uno::Reference < css::frame::XFrame > xFrame; if (GetViewShell()) - xFrame = GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(); + xFrame = GetViewShell()->GetViewFrame().GetFrame().GetFrameInterface(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog( pWin, aItemSet, xFrame )); diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index db3fd0541b83..1b83e930c8c1 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -94,8 +94,8 @@ void ScDrawShell::GetState( SfxItemSet& rSet ) // Conditions / Toggles rSet.Put( SfxBoolItem( SID_BEZIER_EDIT, !pView->IsFrameDragSingles() ) ); sal_uInt16 nFWId = ScGetFontWorkId(); - SfxViewFrame* pViewFrm = rViewData.GetViewShell()->GetViewFrame(); - rSet.Put(SfxBoolItem(SID_FONTWORK, pViewFrm->HasChildWindow(nFWId))); + SfxViewFrame& rViewFrm = rViewData.GetViewShell()->GetViewFrame(); + rSet.Put(SfxBoolItem(SID_FONTWORK, rViewFrm.HasChildWindow(nFWId))); // Notes always default to Page anchor. bool bDisableAnchor = false; diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx index b95f77f9339c..4e95a7d65b07 100644 --- a/sc/source/ui/drawfunc/drawsh5.cxx +++ b/sc/source/ui/drawfunc/drawsh5.cxx @@ -462,15 +462,15 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) case SID_FONTWORK: { sal_uInt16 nId = ScGetFontWorkId(); - SfxViewFrame* pViewFrm = rViewData.GetViewShell()->GetViewFrame(); + SfxViewFrame& rViewFrm = rViewData.GetViewShell()->GetViewFrame(); if ( rReq.GetArgs() ) - pViewFrm->SetChildWindow( nId, + rViewFrm.SetChildWindow( nId, static_cast<const SfxBoolItem&>( (rReq.GetArgs()->Get(SID_FONTWORK))). GetValue() ); else - pViewFrm->ToggleChildWindow( nId ); + rViewFrm.ToggleChildWindow( nId ); rBindings.Invalidate( SID_FONTWORK ); rReq.Done(); diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index f6e8982bd74d..f428465936b3 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -304,7 +304,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) { // Ensure the field is selected first pOutView->SelectFieldAtCursor(); - mrViewData.GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_HYPERLINK_DIALOG); + mrViewData.GetViewShell()->GetViewFrame().GetDispatcher()->Execute(SID_HYPERLINK_DIALOG); } break; @@ -357,8 +357,8 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq ) void ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) { - SfxViewFrame* pViewFrm = mrViewData.GetViewShell()->GetViewFrame(); - bool bHasFontWork = pViewFrm->HasChildWindow(SID_FONTWORK); + SfxViewFrame& rViewFrm = mrViewData.GetViewShell()->GetViewFrame(); + bool bHasFontWork = rViewFrm.HasChildWindow(SID_FONTWORK); bool bDisableFontWork = false; if (IsNoteEdit()) @@ -417,13 +417,13 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet ) } if( rSet.GetItemState( SID_TRANSLITERATE_HALFWIDTH ) != SfxItemState::UNKNOWN ) - ScViewUtil::HideDisabledSlot( rSet, pViewFrm->GetBindings(), SID_TRANSLITERATE_HALFWIDTH ); + ScViewUtil::HideDisabledSlot( rSet, rViewFrm.GetBindings(), SID_TRANSLITERATE_HALFWIDTH ); if( rSet.GetItemState( SID_TRANSLITERATE_FULLWIDTH ) != SfxItemState::UNKNOWN ) - ScViewUtil::HideDisabledSlot( rSet, pViewFrm->GetBindings(), SID_TRANSLITERATE_FULLWIDTH ); + ScViewUtil::HideDisabledSlot( rSet, rViewFrm.GetBindings(), SID_TRANSLITERATE_FULLWIDTH ); if( rSet.GetItemState( SID_TRANSLITERATE_HIRAGANA ) != SfxItemState::UNKNOWN ) - ScViewUtil::HideDisabledSlot( rSet, pViewFrm->GetBindings(), SID_TRANSLITERATE_HIRAGANA ); + ScViewUtil::HideDisabledSlot( rSet, rViewFrm.GetBindings(), SID_TRANSLITERATE_HIRAGANA ); if( rSet.GetItemState( SID_TRANSLITERATE_KATAKANA ) != SfxItemState::UNKNOWN ) - ScViewUtil::HideDisabledSlot( rSet, pViewFrm->GetBindings(), SID_TRANSLITERATE_KATAKANA ); + ScViewUtil::HideDisabledSlot( rSet, rViewFrm.GetBindings(), SID_TRANSLITERATE_KATAKANA ); if ( rSet.GetItemState( SID_ENABLE_HYPHENATION ) != SfxItemState::UNKNOWN ) { diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx index 2f615104b62c..37629721cff4 100644 --- a/sc/source/ui/drawfunc/drtxtob2.cxx +++ b/sc/source/ui/drawfunc/drtxtob2.cxx @@ -135,17 +135,17 @@ void ScDrawTextObjectBar::ExecuteExtra( SfxRequest &rReq ) case SID_FONTWORK: { sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); - SfxViewFrame* pViewFrm = mrViewData.GetViewShell()->GetViewFrame(); + SfxViewFrame& rViewFrm = mrViewData.GetViewShell()->GetViewFrame(); if ( rReq.GetArgs() ) - pViewFrm->SetChildWindow( nId, + rViewFrm.SetChildWindow( nId, static_cast<const SfxBoolItem&>( (rReq.GetArgs()->Get(SID_FONTWORK))). GetValue() ); else - pViewFrm->ToggleChildWindow( nId ); + rViewFrm.ToggleChildWindow( nId ); - pViewFrm->GetBindings().Invalidate( SID_FONTWORK ); + rViewFrm.GetBindings().Invalidate( SID_FONTWORK ); rReq.Done(); } break; diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx index ea5f14a820d4..9076a75ada00 100644 --- a/sc/source/ui/drawfunc/fudraw.cxx +++ b/sc/source/ui/drawfunc/fudraw.cxx @@ -239,7 +239,7 @@ bool FuDraw::KeyInput(const KeyEvent& rKEvt) const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() ) { - bool bOle = rViewShell.GetViewFrame()->GetFrame().IsInPlace(); + bool bOle = rViewShell.GetViewFrame().GetFrame().IsInPlace(); SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); auto pOleObj = dynamic_cast<SdrOle2Obj*>(pObj); if( pOleObj && !bOle ) diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index cf7bd58375fc..72886789b448 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -413,7 +413,7 @@ FuInsertMedia::FuInsertMedia( ScTabViewShell& rViewSh, if( pWin ) pWin->EnterWait(); - css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider(rViewShell.GetViewFrame()->GetFrame().GetFrameInterface(), css::uno::UNO_QUERY); + css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider(rViewShell.GetViewFrame().GetFrame().GetFrameInterface(), css::uno::UNO_QUERY); rtl::Reference<avmedia::PlayerListener> xPlayerListener(new avmedia::PlayerListener( [xDispatchProvider, aURL, bLink](const css::uno::Reference<css::media::XPlayer>& rPlayer){ diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index e753e63214a6..f0d60b45ca19 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -235,13 +235,13 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* if ( nSlot == SID_INSERT_OBJECT && pNameItem ) { const SvGlobalName& aClassName = pNameItem->GetValue(); - xObj = rViewShell.GetViewFrame()->GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject( aClassName.GetByteSequence(), aName ); + xObj = rViewShell.GetViewFrame().GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject( aClassName.GetByteSequence(), aName ); } else if ( nSlot == SID_INSERT_SMATH ) { if ( SvtModuleOptions().IsMath() ) { - xObj = rViewShell.GetViewFrame()->GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject( SvGlobalName( SO3_SM_CLASSID_60 ).GetByteSequence(), aName ); + xObj = rViewShell.GetViewFrame().GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject( SvGlobalName( SO3_SM_CLASSID_60 ).GetByteSequence(), aName ); rReq.AppendItem( SfxGlobalNameItem( SID_INSERT_OBJECT, SvGlobalName( SO3_SM_CLASSID_60 ) ) ); } } diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index 9695702c55e3..03fb8c4c86f5 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -340,7 +340,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) SetMouseButtonCode(rMEvt.GetButtons()); bool bReturn = FuDraw::MouseButtonUp(rMEvt); - bool bOle = rViewShell.GetViewFrame()->GetFrame().IsInPlace(); + bool bOle = rViewShell.GetViewFrame().GetFrame().IsInPlace(); SdrObject* pObj = nullptr; if (aDragTimer.IsActive() ) diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx index 9bd670d3fa9d..7f3089fc076d 100644 --- a/sc/source/ui/drawfunc/futext.cxx +++ b/sc/source/ui/drawfunc/futext.cxx @@ -250,7 +250,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt) } pView->SetDragMode(SdrDragMode::Move); - SfxBindings& rBindings = rViewShell.GetViewFrame()->GetBindings(); + SfxBindings& rBindings = rViewShell.GetViewFrame().GetBindings(); rBindings.Invalidate( SID_OBJECT_ROTATE ); rBindings.Invalidate( SID_OBJECT_MIRROR ); } @@ -314,7 +314,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt) { pWindow->CaptureMouse(); // ForcePointer(&rMEvt); - lcl_InvalidateAttribs( rViewShell.GetViewFrame()->GetBindings() ); + lcl_InvalidateAttribs( rViewShell.GetViewFrame().GetBindings() ); } rViewShell.SetActivePointer(pView->GetPreferredPointer( @@ -368,7 +368,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt) aDragTimer.Stop(); } - lcl_InvalidateAttribs( rViewShell.GetViewFrame()->GetBindings() ); + lcl_InvalidateAttribs( rViewShell.GetViewFrame().GetBindings() ); Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); @@ -485,7 +485,7 @@ bool FuText::KeyInput(const KeyEvent& rKEvt) if ( pView->KeyInput(rKEvt, pWindow) ) { bReturn = true; - lcl_InvalidateAttribs( rViewShell.GetViewFrame()->GetBindings() ); + lcl_InvalidateAttribs( rViewShell.GetViewFrame().GetBindings() ); } else { @@ -498,7 +498,7 @@ bool FuText::KeyInput(const KeyEvent& rKEvt) void FuText::Activate() { pView->SetDragMode(SdrDragMode::Move); - SfxBindings& rBindings = rViewShell.GetViewFrame()->GetBindings(); + SfxBindings& rBindings = rViewShell.GetViewFrame().GetBindings(); rBindings.Invalidate( SID_OBJECT_ROTATE ); rBindings.Invalidate( SID_OBJECT_MIRROR ); |