summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-02-16 10:42:06 +0000
committerCaolán McNamara <caolanm@redhat.com>2023-02-16 15:13:21 +0000
commit0908c7c1184ab7acb7b6f6740a82c2f12c296fae (patch)
tree7bfe09dce871f6f2bc59a81b689d7ab5a3a6f3ea /sfx2
parente71080e19365aa074c56d1136dad2b09783949a2 (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 'sfx2')
-rw-r--r--sfx2/source/appl/appopen.cxx2
-rw-r--r--sfx2/source/appl/appserv.cxx22
-rw-r--r--sfx2/source/control/shell.cxx10
-rw-r--r--sfx2/source/notebookbar/SfxNotebookBar.cxx2
-rw-r--r--sfx2/source/view/ipclient.cxx22
-rw-r--r--sfx2/source/view/lokhelper.cxx21
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx53
-rw-r--r--sfx2/source/view/viewfrm.cxx6
-rw-r--r--sfx2/source/view/viewprn.cxx6
-rw-r--r--sfx2/source/view/viewsh.cxx118
10 files changed, 117 insertions, 145 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 4401fe396911..3dd2383c1074 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -1108,7 +1108,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
{
if ( pShell->GetController() == xController )
{
- pCntrFrame = &pShell->GetViewFrame()->GetFrame();
+ pCntrFrame = &pShell->GetViewFrame().GetFrame();
break;
}
}
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 7b1b387e0f65..83bc6daa210e 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -806,7 +806,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
{
// in LOK case we want to apply changes only to the current view
if (comphelper::LibreOfficeKit::isActive() &&
- pViewFrame != SfxViewShell::Current()->GetViewFrame())
+ pViewFrame != &SfxViewShell::Current()->GetViewFrame())
{
pViewFrame = SfxViewFrame::GetNext( *pViewFrame );
continue;
@@ -1051,9 +1051,9 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW:
{
SfxViewShell* pViewShell = SfxViewShell::Current();
- SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
+ SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
auto nID = rReq.GetSlot();
- pViewFrame->ToggleChildWindow(nID);
+ rViewFrame.ToggleChildWindow(nID);
bDone = true;
break;
@@ -1061,11 +1061,11 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_INSPECT_SELECTED_OBJECT:
{
SfxViewShell* pViewShell = SfxViewShell::Current();
- SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
+ SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
- pViewFrame->ShowChildWindow(SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW, true);
+ rViewFrame.ShowChildWindow(SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW, true);
- SfxChildWindow* pChild = pViewFrame->GetChildWindow(SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW);
+ SfxChildWindow* pChild = rViewFrame.GetChildWindow(SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW);
if (!pChild)
return;
@@ -1280,10 +1280,10 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
auto* pViewShell = SfxViewShell::Current();
if (pViewShell)
{
- auto* pViewFrame = pViewShell->GetViewFrame();
- if (pViewFrame && pViewFrame->KnowsChildWindow(nWhich))
+ auto& rViewFrame = pViewShell->GetViewFrame();
+ if (rViewFrame.KnowsChildWindow(nWhich))
{
- rSet.Put(SfxBoolItem(nWhich, pViewFrame->HasChildWindow(nWhich)));
+ rSet.Put(SfxBoolItem(nWhich, rViewFrame.HasChildWindow(nWhich)));
bSuccess = true;
}
}
@@ -1298,8 +1298,8 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
auto* pViewShell = SfxViewShell::Current();
if (pViewShell)
{
- auto* pViewFrame = pViewShell->GetViewFrame();
- if (pViewFrame && pViewFrame->KnowsChildWindow(SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW))
+ auto& rViewFrame = pViewShell->GetViewFrame();
+ if (rViewFrame.KnowsChildWindow(SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW))
{
bSuccess = true;
}
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index ab3f7e86933c..cf1e8092371b 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -136,7 +136,7 @@ SfxViewFrame* SfxShell::GetFrame() const
if ( pImpl->pFrame )
return pImpl->pFrame;
if ( pImpl->pViewSh )
- return pImpl->pViewSh->GetViewFrame();
+ return &pImpl->pViewSh->GetViewFrame();
return nullptr;
}
@@ -246,7 +246,7 @@ void SfxShell::Invalidate
return;
}
- Invalidate_Impl( GetViewShell()->GetViewFrame()->GetBindings(), nId );
+ Invalidate_Impl( GetViewShell()->GetViewFrame().GetBindings(), nId );
}
void SfxShell::Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId )
@@ -548,7 +548,7 @@ void SfxShell::SetVerbs(const css::uno::Sequence < css::embed::VerbDescriptor >&
// the Slots
{
SfxBindings *pBindings =
- pViewSh->GetViewFrame()->GetDispatcher()->GetBindings();
+ pViewSh->GetViewFrame().GetDispatcher()->GetBindings();
sal_uInt16 nCount = pImpl->aSlotArr.size();
for (sal_uInt16 n1=0; n1<nCount ; n1++)
{
@@ -597,7 +597,7 @@ void SfxShell::SetVerbs(const css::uno::Sequence < css::embed::VerbDescriptor >&
// The status of SID_OBJECT is collected in the controller directly on
// the Shell, it is thus enough to encourage a new status update
- SfxBindings* pBindings = pViewSh->GetViewFrame()->GetDispatcher()->GetBindings();
+ SfxBindings* pBindings = pViewSh->GetViewFrame().GetDispatcher()->GetBindings();
pBindings->Invalidate(SID_OBJECT, true, true);
}
@@ -656,7 +656,7 @@ const SfxSlot* SfxShell::GetVerbSlot_Impl(sal_uInt16 nId) const
SfxObjectShell* SfxShell::GetObjectShell()
{
if ( GetViewShell() )
- return GetViewShell()->GetViewFrame()->GetObjectShell();
+ return GetViewShell()->GetViewFrame().GetObjectShell();
else
return nullptr;
}
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 80e8c896fe21..3b33ef7dd781 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -578,7 +578,7 @@ void SfxNotebookBar::ReloadNotebookBar(std::u16string_view sUIPath)
if (SfxNotebookBar::IsActive())
{
SfxViewShell* pViewShell = SfxViewShell::Current();
- sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame()->GetBindings(), sUIPath, true);
+ sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame().GetBindings(), sUIPath, true);
}
}
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index fd52355f3ed5..e83d786e543f 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -218,7 +218,7 @@ uno::Reference < frame::XFrame > const & SfxInPlaceClient_Impl::GetFrame() const
{
if ( !m_pClient )
throw uno::RuntimeException();
- return m_pClient->GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface();
+ return m_pClient->GetViewShell()->GetViewFrame().GetFrame().GetFrameInterface();
}
void SAL_CALL SfxInPlaceClient_Impl::saveObject()
@@ -725,7 +725,7 @@ void SfxInPlaceClient::SetObject( const uno::Reference < embed::XEmbeddedObject
}
}
- if ( m_pViewSh->GetViewFrame()->GetFrame().IsClosing_Impl() )
+ if ( m_pViewSh->GetViewFrame().GetFrame().IsClosing_Impl() )
// sometimes applications reconnect clients on shutting down because it happens in their Paint methods
return;
@@ -963,7 +963,7 @@ ErrCode SfxInPlaceClient::DoVerb(sal_Int32 nVerb)
{
pEditWin->EnableMapMode();
}
- m_pViewSh->GetViewFrame()->GetFrame().LockResize_Impl(true);
+ m_pViewSh->GetViewFrame().GetFrame().LockResize_Impl(true);
try
{
m_xImp->m_xObject->setClientSite( m_xImp );
@@ -1017,9 +1017,9 @@ ErrCode SfxInPlaceClient::DoVerb(sal_Int32 nVerb)
{
pEditWin->EnableMapMode(false);
}
- SfxViewFrame* pFrame = m_pViewSh->GetViewFrame();
- pFrame->GetFrame().LockResize_Impl(false);
- pFrame->GetFrame().Resize();
+ SfxViewFrame& rFrame = m_pViewSh->GetViewFrame();
+ rFrame.GetFrame().LockResize_Impl(false);
+ rFrame.GetFrame().Resize();
}
}
}
@@ -1079,7 +1079,7 @@ void SfxInPlaceClient::DeactivateObject()
}
}
- m_pViewSh->GetViewFrame()->GetFrame().LockResize_Impl(true);
+ m_pViewSh->GetViewFrame().GetFrame().LockResize_Impl(true);
if ( m_xImp->m_xObject->getStatus( m_xImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
{
@@ -1097,10 +1097,10 @@ void SfxInPlaceClient::DeactivateObject()
m_xImp->m_xObject->changeState( embed::EmbedStates::RUNNING );
}
- SfxViewFrame* pFrame = m_pViewSh->GetViewFrame();
- SfxViewFrame::SetViewFrame( pFrame );
- pFrame->GetFrame().LockResize_Impl(false);
- pFrame->GetFrame().Resize();
+ SfxViewFrame& rFrame = m_pViewSh->GetViewFrame();
+ SfxViewFrame::SetViewFrame( &rFrame );
+ rFrame.GetFrame().LockResize_Impl(false);
+ rFrame.GetFrame().Resize();
}
catch (css::uno::Exception& )
{}
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 29f64adbb74b..c0cd925741f7 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -80,16 +80,13 @@ bool g_isDefaultTimezoneSet = false;
OUString g_DefaultTimezone;
}
-int SfxLokHelper::createView(SfxViewFrame* pViewFrame, ViewShellDocId docId)
+int SfxLokHelper::createView(SfxViewFrame& rViewFrame, ViewShellDocId docId)
{
assert(docId >= ViewShellDocId(0) && "Cannot createView for invalid (negative) DocId.");
- if (pViewFrame == nullptr)
- return -1;
-
SfxViewShell::SetCurrentDocId(docId);
- SfxRequest aRequest(pViewFrame, SID_NEWWINDOW);
- pViewFrame->ExecView_Impl(aRequest);
+ SfxRequest aRequest(&rViewFrame, SID_NEWWINDOW);
+ rViewFrame.ExecView_Impl(aRequest);
SfxViewShell* pViewShell = SfxViewShell::Current();
if (pViewShell == nullptr)
return -1;
@@ -147,9 +144,9 @@ void SfxLokHelper::destroyView(int nId)
{
if (pViewShell->GetViewShellId() == nViewShellId)
{
- SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
- SfxRequest aRequest(pViewFrame, SID_CLOSEWIN);
- pViewFrame->Exec_Impl(aRequest);
+ SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
+ SfxRequest aRequest(&rViewFrame, SID_CLOSEWIN);
+ rViewFrame.Exec_Impl(aRequest);
break;
}
}
@@ -177,11 +174,11 @@ void SfxLokHelper::setView(int nId)
if (pViewShell == SfxViewShell::Current())
return;
- SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
- pViewFrame->MakeActive_Impl(false);
+ SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
+ rViewFrame.MakeActive_Impl(false);
// Make comphelper::dispatchCommand() find the correct frame.
- uno::Reference<frame::XFrame> xFrame = pViewFrame->GetFrame().GetFrameInterface();
+ uno::Reference<frame::XFrame> xFrame = rViewFrame.GetFrame().GetFrameInterface();
uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(comphelper::getProcessComponentContext());
xDesktop->setActiveFrame(xFrame);
return;
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index 03b4ab4e4faf..199a46d9b695 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -401,11 +401,11 @@ void SAL_CALL IMPL_SfxBaseController_ListenerHelper::frameAction( const frame::F
if ( aEvent.Action == frame::FrameAction_FRAME_UI_ACTIVATED )
{
if ( !m_pController->GetViewShell_Impl()->GetUIActiveIPClient_Impl() )
- m_pController->GetViewShell_Impl()->GetViewFrame()->MakeActive_Impl( false );
+ m_pController->GetViewShell_Impl()->GetViewFrame().MakeActive_Impl( false );
}
else if ( aEvent.Action == frame::FrameAction_CONTEXT_CHANGED )
{
- m_pController->GetViewShell_Impl()->GetViewFrame()->GetBindings().ContextChanged_Impl();
+ m_pController->GetViewShell_Impl()->GetViewFrame().GetBindings().ContextChanged_Impl();
}
}
}
@@ -718,12 +718,12 @@ Reference< frame::XDispatch > SAL_CALL SfxBaseController::queryDispatch( const
if (!m_pData->m_bDisposing && m_pData->m_pViewShell)
{
- SfxViewFrame* pAct = m_pData->m_pViewShell->GetViewFrame() ;
+ SfxViewFrame& rAct = m_pData->m_pViewShell->GetViewFrame() ;
if ( sTargetFrameName == "_beamer" )
{
if ( eSearchFlags & frame::FrameSearchFlag::CREATE )
- pAct->SetChildWindow( SID_BROWSER, true );
- if (SfxChildWindow* pChildWin = pAct->GetChildWindow(SID_BROWSER))
+ rAct.SetChildWindow( SID_BROWSER, true );
+ if (SfxChildWindow* pChildWin = rAct.GetChildWindow(SID_BROWSER))
{
if (Reference<frame::XFrame> xFrame{ pChildWin->GetFrame() })
{
@@ -740,8 +740,8 @@ Reference< frame::XDispatch > SAL_CALL SfxBaseController::queryDispatch( const
bool bMasterCommand(!aActCommand.isEmpty());
if (!bMasterCommand)
aActCommand = aURL.Path;
- const SfxSlot* pSlot = SfxSlotPool::GetSlotPool(pAct).GetUnoSlot(aActCommand);
- return GetSlotDispatchWithFallback(pAct, aURL, aActCommand, bMasterCommand, pSlot);
+ const SfxSlot* pSlot = SfxSlotPool::GetSlotPool(&rAct).GetUnoSlot(aActCommand);
+ return GetSlotDispatchWithFallback(&rAct, aURL, aActCommand, bMasterCommand, pSlot);
}
else if ( aURL.Protocol == "slot:" )
{
@@ -751,11 +751,11 @@ Reference< frame::XDispatch > SAL_CALL SfxBaseController::queryDispatch( const
{
const SfxSlot* pSlot = m_pData->m_pViewShell->GetVerbSlot_Impl(nId);
if ( pSlot )
- return pAct->GetBindings().GetDispatch( pSlot, aURL, false );
+ return rAct.GetBindings().GetDispatch( pSlot, aURL, false );
}
- const SfxSlot* pSlot = SfxSlotPool::GetSlotPool(pAct).GetSlot(nId);
- return GetSlotDispatchWithFallback(pAct, aURL, aURL.Path, false, pSlot);
+ const SfxSlot* pSlot = SfxSlotPool::GetSlotPool(&rAct).GetSlot(nId);
+ return GetSlotDispatchWithFallback(&rAct, aURL, aURL.Path, false, pSlot);
}
else if( sTargetFrameName == "_self" || sTargetFrameName.isEmpty() )
{
@@ -763,10 +763,10 @@ Reference< frame::XDispatch > SAL_CALL SfxBaseController::queryDispatch( const
Reference< frame::XModel > xModel = getModel();
if( xModel.is() && !aURL.Mark.isEmpty() )
{
- SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pAct );
+ SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( &rAct );
const SfxSlot* pSlot = rSlotPool.GetSlot( SID_JUMPTOMARK );
if( !aURL.Main.isEmpty() && aURL.Main == xModel->getURL() && pSlot )
- return Reference< frame::XDispatch >( new SfxOfficeDispatch( pAct->GetBindings(), pAct->GetDispatcher(), pSlot, aURL) );
+ return Reference< frame::XDispatch >( new SfxOfficeDispatch( rAct.GetBindings(), rAct.GetDispatcher(), pSlot, aURL) );
}
}
}
@@ -882,23 +882,20 @@ void SAL_CALL SfxBaseController::dispose()
if ( !m_pData->m_pViewShell )
return;
- SfxViewFrame* pFrame = m_pData->m_pViewShell->GetViewFrame() ;
- if ( pFrame && pFrame->GetViewShell() == m_pData->m_pViewShell )
- pFrame->GetFrame().SetIsClosing_Impl();
+ SfxViewFrame& rFrame = m_pData->m_pViewShell->GetViewFrame() ;
+ if (rFrame.GetViewShell() == m_pData->m_pViewShell )
+ rFrame.GetFrame().SetIsClosing_Impl();
m_pData->m_pViewShell->DisconnectAllClients();
- if ( !pFrame )
- return;
-
lang::EventObject aObject;
aObject.Source = *this ;
- SfxObjectShell* pDoc = pFrame->GetObjectShell() ;
+ SfxObjectShell* pDoc = rFrame.GetObjectShell() ;
SfxViewFrame *pView = SfxViewFrame::GetFirst(pDoc);
while( pView )
{
// if there is another ViewFrame or currently the ViewShell in my ViewFrame is switched (PagePreview)
- if ( pView != pFrame || pView->GetViewShell() != m_pData->m_pViewShell )
+ if ( pView != &rFrame || pView->GetViewShell() != m_pData->m_pViewShell )
break;
pView = SfxViewFrame::GetNext( *pView, pDoc );
}
@@ -922,13 +919,13 @@ void SAL_CALL SfxBaseController::dispose()
m_pData->m_xListener->disposing( aObject );
SfxViewShell *pShell = m_pData->m_pViewShell;
m_pData->m_pViewShell = nullptr;
- if ( pFrame->GetViewShell() == pShell )
+ if (rFrame.GetViewShell() == pShell)
{
// Enter registrations only allowed if we are the owner!
- if ( pFrame->GetFrame().OwnsBindings_Impl() )
- pFrame->GetBindings().ENTERREGISTRATIONS();
- pFrame->GetFrame().SetFrameInterface_Impl( aXFrame );
- pFrame->GetFrame().DoClose_Impl();
+ if ( rFrame.GetFrame().OwnsBindings_Impl() )
+ rFrame.GetBindings().ENTERREGISTRATIONS();
+ rFrame.GetFrame().SetFrameInterface_Impl( aXFrame );
+ rFrame.GetFrame().DoClose_Impl();
}
}
@@ -992,7 +989,7 @@ Reference< task::XStatusIndicator > SAL_CALL SfxBaseController::getStatusIndicat
{
SolarMutexGuard aGuard;
if ( m_pData->m_pViewShell && !m_pData->m_xIndicator.is() )
- m_pData->m_xIndicator = new SfxStatusIndicator( this, m_pData->m_pViewShell->GetViewFrame()->GetFrame().GetWorkWindow_Impl() );
+ m_pData->m_xIndicator = new SfxStatusIndicator( this, m_pData->m_pViewShell->GetViewFrame().GetFrame().GetWorkWindow_Impl() );
return m_pData->m_xIndicator;
}
@@ -1144,8 +1141,8 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect )
&& ( m_pData->m_pViewShell->GetObjectShell()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
)
{
- SfxViewFrame* pViewFrm = m_pData->m_pViewShell->GetViewFrame();
- if ( !pViewFrm->GetFrame().IsInPlace() )
+ SfxViewFrame& rViewFrm = m_pData->m_pViewShell->GetViewFrame();
+ if ( !rViewFrm.GetFrame().IsInPlace() )
{
// for outplace embedded objects, we want the layout manager to keep the content window
// size constant, if possible
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index a3b3e551a9db..246c20707b8d 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -2255,7 +2255,7 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell
}
if ( pSuccessView )
- return pSuccessView->GetViewFrame();
+ return &pSuccessView->GetViewFrame();
if ( bOwnFrame )
{
@@ -3049,8 +3049,8 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const OUString& sMacro )
{
if ( pViewShell->GetName() == "BasicIDE" )
{
- SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
- SfxDispatcher* pDispat = pViewFrame ? pViewFrame->GetDispatcher() : nullptr;
+ SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
+ SfxDispatcher* pDispat = rViewFrame.GetDispatcher();
if ( pDispat )
{
SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLibName, aModuleName, OUString(), OUString() );
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 9476dd22edec..9229d541b183 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -358,7 +358,7 @@ void SfxPrinterController::jobFinished( css::view::PrintableState nState )
case view::PrintableState_JOB_SPOOLED :
case view::PrintableState_JOB_COMPLETED :
{
- SfxBindings& rBind = mpViewShell->GetViewFrame()->GetBindings();
+ SfxBindings& rBind = mpViewShell->GetViewFrame().GetBindings();
rBind.Invalidate( SID_PRINTDOC );
rBind.Invalidate( SID_PRINTDOCDIRECT );
rBind.Invalidate( SID_SETUPPRINTER );
@@ -655,7 +655,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
// no help button in dialogs if called from the help window
// (pressing help button would exchange the current page inside the help
// document that is going to be printed!)
- SfxMedium* pMedium = GetViewFrame()->GetObjectShell()->GetMedium();
+ SfxMedium* pMedium = GetViewFrame().GetObjectShell()->GetMedium();
std::shared_ptr<const SfxFilter> pFilter = pMedium ? pMedium->GetFilter() : nullptr;
bool bPrintOnHelp = ( pFilter && pFilter->GetFilterName() == "writer_web_HTML_help" );
@@ -874,7 +874,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
if (pPrinter->GetName() != pDlgPrinter->GetName())
{
// user has changed the printer -> macro recording
- SfxRequest aReq(GetViewFrame(), SID_PRINTER_NAME);
+ SfxRequest aReq(&GetViewFrame(), SID_PRINTER_NAME);
aReq.AppendItem(SfxStringItem(SID_PRINTER_NAME, pDlgPrinter->GetName()));
aReq.Done();
}
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 535784ea6300..09e4b4a32284 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -161,7 +161,7 @@ void SfxClipboardChangeListener::ChangedContents()
if (!m_pViewShell)
return;
- SfxBindings& rBind = m_pViewShell->GetViewFrame()->GetBindings();
+ SfxBindings& rBind = m_pViewShell->GetViewFrame().GetBindings();
rBind.Invalidate(SID_PASTE);
rBind.Invalidate(SID_PASTE_SPECIAL);
rBind.Invalidate(SID_CLIPBOARD_FORMAT_ITEMS);
@@ -387,7 +387,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
case SID_ACTIVATE_STYLE_APPLY:
{
uno::Reference< frame::XFrame > xFrame =
- GetViewFrame()->GetFrame().GetFrameInterface();
+ GetViewFrame().GetFrame().GetFrameInterface();
Reference< beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
Reference< frame::XLayoutManager > xLayoutManager;
@@ -448,7 +448,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
{
SfxObjectShell* pDoc = GetObjectShell();
if ( pDoc && pDoc->QueryHiddenInformation(
- HiddenWarningFact::WhenSaving, GetViewFrame()->GetFrameWeld() ) != RET_YES )
+ HiddenWarningFact::WhenSaving, GetViewFrame().GetFrameWeld() ) != RET_YES )
break;
@@ -469,7 +469,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
if ( pMailDocType )
aDocType = pMailDocType->GetValue();
- uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() );
+ uno::Reference < frame::XFrame > xFrame( rFrame.GetFrame().GetFrameInterface() );
SfxMailModel::SendMailResult eResult = SfxMailModel::SEND_MAIL_ERROR;
if ( nId == SID_MAIL_SENDDOC )
@@ -508,9 +508,9 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
SfxBluetoothModel aModel;
SfxObjectShell* pDoc = GetObjectShell();
if ( pDoc && pDoc->QueryHiddenInformation(
- HiddenWarningFact::WhenSaving, GetViewFrame()->GetFrameWeld() ) != RET_YES )
+ HiddenWarningFact::WhenSaving, GetViewFrame().GetFrameWeld() ) != RET_YES )
break;
- uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() );
+ uno::Reference < frame::XFrame > xFrame( rFrame.GetFrame().GetFrameInterface() );
SfxMailModel::SendMailResult eResult = aModel.SaveAndSend( xFrame );
if( eResult == SfxMailModel::SEND_MAIL_ERROR )
{
@@ -531,7 +531,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
{
css::uno::Reference< lang::XMultiServiceFactory > xSMGR(::comphelper::getProcessServiceFactory(), css::uno::UNO_SET_THROW);
css::uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext(), css::uno::UNO_SET_THROW);
- css::uno::Reference< css::frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() );
+ css::uno::Reference< css::frame::XFrame > xFrame( rFrame.GetFrame().GetFrameInterface() );
css::uno::Reference< css::frame::XModel > xModel;
css::uno::Reference< css::frame::XModuleManager2 > xModuleManager( css::frame::ModuleManager::create(xContext) );
@@ -657,7 +657,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet )
{
SfxWhichIter aIter( rSet );
- SfxObjectShell *pSh = GetViewFrame()->GetObjectShell();
+ SfxObjectShell *pSh = GetViewFrame().GetObjectShell();
for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
{
switch ( nSID )
@@ -707,7 +707,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet )
aPrinterName = Printer::GetDefaultPrinterName();
if ( !aPrinterName.isEmpty() )
{
- uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() );
+ uno::Reference < frame::XFrame > xFrame( rFrame.GetFrame().GetFrameInterface() );
auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:PrintDefault",
vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
@@ -759,26 +759,24 @@ void SfxViewShell::OutplaceActivated( bool bActive )
void SfxViewShell::UIActivating( SfxInPlaceClient* /*pClient*/ )
{
- uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame().GetFrameInterface() );
+ uno::Reference < frame::XFrame > xOwnFrame( rFrame.GetFrame().GetFrameInterface() );
uno::Reference < frame::XFramesSupplier > xParentFrame = xOwnFrame->getCreator();
if ( xParentFrame.is() )
xParentFrame->setActiveFrame( xOwnFrame );
- pFrame->GetBindings().HidePopups();
- pFrame->GetDispatcher()->Update_Impl( true );
+ rFrame.GetBindings().HidePopups();
+ rFrame.GetDispatcher()->Update_Impl( true );
}
-
void SfxViewShell::UIDeactivated( SfxInPlaceClient* /*pClient*/ )
{
- if ( !pFrame->GetFrame().IsClosing_Impl() || SfxViewFrame::Current() != pFrame )
- pFrame->GetDispatcher()->Update_Impl( true );
- pFrame->GetBindings().HidePopups(false);
+ if ( !rFrame.GetFrame().IsClosing_Impl() || SfxViewFrame::Current() != &rFrame )
+ rFrame.GetDispatcher()->Update_Impl( true );
+ rFrame.GetBindings().HidePopups(false);
- pFrame->GetBindings().InvalidateAll(true);
+ rFrame.GetBindings().InvalidateAll(true);
}
-
SfxInPlaceClient* SfxViewShell::FindIPClient
(
const uno::Reference < embed::XEmbeddedObject >& xObj,
@@ -845,7 +843,7 @@ void SfxViewShell::Activate( bool bMDI )
{
if ( bMDI )
{
- SfxObjectShell *pSh = GetViewFrame()->GetObjectShell();
+ SfxObjectShell *pSh = GetViewFrame().GetObjectShell();
if (const auto xModel = pSh->GetModel())
xModel->setCurrentController(GetController());
@@ -978,24 +976,18 @@ void SfxViewShell::InnerResizePixel
SetBorderPixel( SvBorder() );
}
-
void SfxViewShell::InvalidateBorder()
{
- DBG_ASSERT( GetViewFrame(), "SfxViewShell without SfxViewFrame" );
-
- GetViewFrame()->InvalidateBorderImpl( this );
+ GetViewFrame().InvalidateBorderImpl( this );
if (pImpl->m_pController.is())
{
pImpl->m_pController->BorderWidthsChanged_Impl();
}
}
-
void SfxViewShell::SetBorderPixel( const SvBorder &rBorder )
{
- DBG_ASSERT( GetViewFrame(), "SfxViewShell without SfxViewFrame" );
-
- GetViewFrame()->SetBorderPixelImpl( this, rBorder );
+ GetViewFrame().SetBorderPixelImpl( this, rBorder );
// notify related controller that border size is changed
if (pImpl->m_pController.is())
@@ -1004,15 +996,11 @@ void SfxViewShell::SetBorderPixel( const SvBorder &rBorder )
}
}
-
const SvBorder& SfxViewShell::GetBorderPixel() const
{
- DBG_ASSERT( GetViewFrame(), "SfxViewShell without SfxViewFrame" );
-
- return GetViewFrame()->GetBorderPixelImpl();
+ return GetViewFrame().GetBorderPixelImpl();
}
-
void SfxViewShell::SetWindow
(
vcl::Window* pViewPort // For example Null pointer in the Destructor.
@@ -1061,7 +1049,7 @@ SfxViewShell::SfxViewShell
: SfxShell(this)
, pImpl( new SfxViewShell_Impl(nFlags, SfxViewShell::mnCurrentDocId) )
-, pFrame(&rViewFrame)
+, rFrame(rViewFrame)
, pWindow(nullptr)
, bNoNewWindow( nFlags & SfxViewShellFlags::NO_NEWWINDOW )
, mbPrinterSettingsModified(false)
@@ -1095,7 +1083,6 @@ SfxViewShell::SfxViewShell
}
}
-
SfxViewShell::~SfxViewShell()
{
// Remove from list
@@ -1116,7 +1103,7 @@ SfxViewShell::~SfxViewShell()
pImpl->m_pController.clear();
}
- vcl::Window* pFrameWin = GetViewFrame()->GetWindow().GetFrameWindow();
+ vcl::Window* pFrameWin = GetViewFrame().GetWindow().GetFrameWindow();
if (pFrameWin && pFrameWin->GetLOKNotifier() == this)
pFrameWin->ReleaseLOKNotifier();
}
@@ -1126,15 +1113,15 @@ bool SfxViewShell::PrepareClose
bool bUI // TRUE: Allow Dialog and so on, FALSE: silent-mode
)
{
- if (GetViewFrame()->GetWindow().GetLOKNotifier() == this)
- GetViewFrame()->GetWindow().ReleaseLOKNotifier();
+ if (GetViewFrame().GetWindow().GetLOKNotifier() == this)
+ GetViewFrame().GetWindow().ReleaseLOKNotifier();
SfxPrinter *pPrinter = GetPrinter();
if ( pPrinter && pPrinter->IsPrinting() )
{
if ( bUI )
{
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetViewFrame()->GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetViewFrame().GetFrameWeld(),
VclMessageType::Info, VclButtonsType::Ok,
SfxResId(STR_CANT_CLOSE)));
xBox->run();
@@ -1143,10 +1130,10 @@ bool SfxViewShell::PrepareClose
return false;
}
- if( GetViewFrame()->IsInModalMode() )
+ if( GetViewFrame().IsInModalMode() )
return false;
- if( bUI && GetViewFrame()->GetDispatcher()->IsLocked() )
+ if( bUI && GetViewFrame().GetDispatcher()->IsLocked() )
return false;
return true;
@@ -1238,7 +1225,7 @@ bool SfxViewShell::HasSelection( bool ) const
void SfxViewShell::AddSubShell( SfxShell& rShell )
{
pImpl->aArr.push_back(&rShell);
- SfxDispatcher *pDisp = pFrame->GetDispatcher();
+ SfxDispatcher *pDisp = rFrame.GetDispatcher();
if ( pDisp->IsActive(*this) )
{
pDisp->Push(rShell);
@@ -1248,7 +1235,7 @@ void SfxViewShell::AddSubShell( SfxShell& rShell )
void SfxViewShell::RemoveSubShell( SfxShell* pShell )
{
- SfxDispatcher *pDisp = pFrame->GetDispatcher();
+ SfxDispatcher *pDisp = rFrame.GetDispatcher();
if ( !pShell )
{
size_t nCount = pImpl->aArr.size();
@@ -1285,7 +1272,7 @@ SfxShell* SfxViewShell::GetSubShell( sal_uInt16 nNo )
void SfxViewShell::PushSubShells_Impl( bool bPush )
{
- SfxDispatcher *pDisp = pFrame->GetDispatcher();
+ SfxDispatcher *pDisp = rFrame.GetDispatcher();
if ( bPush )
{
for (auto const& elem : pImpl->aArr)
@@ -1340,8 +1327,8 @@ SfxViewShell* SfxViewShell::GetFirst
// a destroyed ViewFrame is not in the ViewFrame array anymore, so checking this array helps
// That doesn't seem to be needed anymore, but keep an assert, just in case.
assert(std::find(SfxGetpApp()->GetViewFrames_Impl().begin(), SfxGetpApp()->GetViewFrames_Impl().end(),
- pShell->GetViewFrame()) != SfxGetpApp()->GetViewFrames_Impl().end());
- if ( ( !bOnlyVisible || pShell->GetViewFrame()->IsVisible() ) && (!isViewShell || isViewShell(pShell)))
+ &pShell->GetViewFrame()) != SfxGetpApp()->GetViewFrames_Impl().end());
+ if ( ( !bOnlyVisible || pShell->GetViewFrame().IsVisible() ) && (!isViewShell || isViewShell(pShell)))
return pShell;
}
}
@@ -1349,9 +1336,7 @@ SfxViewShell* SfxViewShell::GetFirst
return nullptr;
}
-
// returns the next shell of spec. type viewing the specified doc.
-
SfxViewShell* SfxViewShell::GetNext
(
const SfxViewShell& rPrev,
@@ -1371,8 +1356,8 @@ SfxViewShell* SfxViewShell::GetNext
if ( pShell )
{
assert(std::find(SfxGetpApp()->GetViewFrames_Impl().begin(), SfxGetpApp()->GetViewFrames_Impl().end(),
- pShell->GetViewFrame()) != SfxGetpApp()->GetViewFrames_Impl().end());
- if ( ( !bOnlyVisible || pShell->GetViewFrame()->IsVisible() ) && (!isViewShell || isViewShell(pShell)) )
+ &pShell->GetViewFrame()) != SfxGetpApp()->GetViewFrames_Impl().end());
+ if ( ( !bOnlyVisible || pShell->GetViewFrame().IsVisible() ) && (!isViewShell || isViewShell(pShell)) )
return pShell;
}
}
@@ -1395,7 +1380,7 @@ void SfxViewShell::Notify( SfxBroadcaster& rBC,
auto &rFrames = SfxGetpApp()->GetViewFrames_Impl();
for (SfxViewFrame* frame : rFrames)
{
- if ( frame == GetViewFrame() && &rBC == GetObjectShell() )
+ if ( frame == &GetViewFrame() && &rBC == GetObjectShell() )
{
SfxItemSet* pSet = GetObjectShell()->GetMedium()->GetItemSet();
const SfxUnoAnyItem* pItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pSet, SID_VIEW_DATA, false);
@@ -1415,7 +1400,7 @@ bool SfxViewShell::ExecKey_Impl(const KeyEvent& aKey)
{
pImpl->m_xAccExec = ::svt::AcceleratorExecute::createAcceleratorHelper();
pImpl->m_xAccExec->init(::comphelper::getProcessComponentContext(),
- pFrame->GetFrame().GetFrameInterface());
+ rFrame.GetFrame().GetFrameInterface());
}
return pImpl->m_xAccExec->execute(aKey.GetKeyCode());
@@ -1787,13 +1772,11 @@ void SfxViewShell::CheckIPClient_Impl(
}
}
-
SfxObjectShell* SfxViewShell::GetObjectShell()
{
- return pFrame ? pFrame->GetObjectShell() : nullptr;
+ return rFrame.GetObjectShell();
}
-
Reference< XModel > SfxViewShell::GetCurrentDocument() const
{
Reference< XModel > xDocument;
@@ -1843,7 +1826,7 @@ void SfxViewShell::MarginChanged()
void SfxViewShell::JumpToMark( const OUString& rMark )
{
SfxStringItem aMarkItem( SID_JUMPTOMARK, rMark );
- GetViewFrame()->GetDispatcher()->ExecuteList(
+ GetViewFrame().GetDispatcher()->ExecuteList(
SID_JUMPTOMARK,
SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
{ &aMarkItem });
@@ -2039,7 +2022,7 @@ bool SfxViewShell::HasMouseClickListeners_Impl() const
bool SfxViewShell::Escape()
{
- return GetViewFrame()->GetBindings().Execute( SID_TERMINATE_INPLACEACTIVATION );
+ return GetViewFrame().GetBindings().Execute(SID_TERMINATE_INPLACEACTIVATION);
}
Reference< view::XRenderable > SfxViewShell::GetRenderable()
@@ -2063,9 +2046,7 @@ void SfxViewShell::notifyWindow(vcl::LOKWindowId nDialogId, const OUString& rAct
uno::Reference< datatransfer::clipboard::XClipboardNotifier > SfxViewShell::GetClipboardNotifier() const
{
uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClipboardNotifier;
- if ( GetViewFrame() )
- xClipboardNotifier.set( GetViewFrame()->GetWindow().GetClipboard(), uno::UNO_QUERY );
-
+ xClipboardNotifier.set(GetViewFrame().GetWindow().GetClipboard(), uno::UNO_QUERY);
return xClipboardNotifier;
}
@@ -2073,19 +2054,16 @@ void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransf
{
try
{
- if ( GetViewFrame() )
+ uno::Reference< datatransfer::clipboard::XClipboard > xClipboard(GetViewFrame().GetWindow().GetClipboard());
+ if( xClipboard.is() )
{
- uno::Reference< datatransfer::clipboard::XClipboard > xClipboard( GetViewFrame()->GetWindow().GetClipboard() );
- if( xClipboard.is() )
+ uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY );
+ if( xClpbrdNtfr.is() )
{
- uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY );
- if( xClpbrdNtfr.is() )
- {
- if( bAdd )
- xClpbrdNtfr->addClipboardListener( rClp );
- else
- xClpbrdNtfr->removeClipboardListener( rClp );
- }
+ if( bAdd )
+ xClpbrdNtfr->addClipboardListener( rClp );
+ else
+ xClpbrdNtfr->removeClipboardListener( rClp );
}
}
}