summaryrefslogtreecommitdiff
path: root/sw/source/uibase/app
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/app')
-rw-r--r--sw/source/uibase/app/apphdl.cxx19
-rw-r--r--sw/source/uibase/app/swmodul1.cxx3
2 files changed, 13 insertions, 9 deletions
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index bbc2ada8e165..546fd6902276 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -172,9 +172,8 @@ void SwModule::StateOther(SfxItemSet &rSet)
case FN_MAILMERGE_NEXT_ENTRY:
case FN_MAILMERGE_LAST_ENTRY:
{
- SwView* pView = ::GetActiveView();
std::shared_ptr<SwMailMergeConfigItem> xConfigItem;
- if (pView)
+ if (SwView* pView = GetActiveView())
xConfigItem = pView->GetMailMergeConfigItem();
if (!xConfigItem)
rSet.DisableItem(nWhich);
@@ -206,9 +205,8 @@ void SwModule::StateOther(SfxItemSet &rSet)
case FN_MAILMERGE_PRINT_DOCUMENTS:
case FN_MAILMERGE_EMAIL_DOCUMENTS:
{
- SwView* pView = ::GetActiveView();
std::shared_ptr<SwMailMergeConfigItem> xConfigItem;
- if (pView)
+ if (SwView* pView = GetActiveView())
xConfigItem = pView->EnsureMailMergeConfigItem();
// #i51949# hide e-Mail option if e-Mail is not supported
@@ -752,6 +750,9 @@ void SwModule::ExecOther(SfxRequest& rReq)
case FN_MAILMERGE_CURRENT_ENTRY:
{
SwView* pView = ::GetActiveView();
+ if (!pView)
+ return;
+
const std::shared_ptr<SwMailMergeConfigItem>& xConfigItem = pView->GetMailMergeConfigItem();
if (!xConfigItem)
return;
@@ -813,14 +814,18 @@ void SwModule::ExecOther(SfxRequest& rReq)
case FN_MAILMERGE_PRINT_DOCUMENTS:
case FN_MAILMERGE_EMAIL_DOCUMENTS:
{
- std::shared_ptr<SwMailMergeConfigItem> xConfigItem = GetActiveView()->GetMailMergeConfigItem();
+ SwView* pView = ::GetActiveView();
+ if (!pView)
+ return;
+
+ std::shared_ptr<SwMailMergeConfigItem> xConfigItem = pView->GetMailMergeConfigItem();
assert(xConfigItem);
if (!xConfigItem->GetResultSet().is())
{
// The connection has been attempted, but failed or no results found,
// so invalidate the toolbar buttons in case they need to be disabled.
SfxBindings& rBindings
- = GetActiveView()->GetWrtShell().GetView().GetViewFrame().GetBindings();
+ = pView->GetWrtShell().GetView().GetViewFrame().GetBindings();
rBindings.Invalidate(FN_MAILMERGE_CREATE_DOCUMENTS);
rBindings.Invalidate(FN_MAILMERGE_SAVE_DOCUMENTS);
rBindings.Invalidate(FN_MAILMERGE_PRINT_DOCUMENTS);
@@ -835,7 +840,7 @@ void SwModule::ExecOther(SfxRequest& rReq)
if (nWhich == FN_MAILMERGE_CREATE_DOCUMENTS)
{
- xConfigItem = SwDBManager::PerformMailMerge(GetActiveView());
+ xConfigItem = SwDBManager::PerformMailMerge(pView);
if (xConfigItem && xConfigItem->GetTargetView())
xConfigItem->GetTargetView()->GetViewFrame().GetFrame().Appear();
diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx
index a74b43821643..64bd38f44458 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -107,8 +107,7 @@ static void lcl_SetUIPrefs(const SwViewOption &rPref, SwView* pView, SwViewShell
SwWrtShell* GetActiveWrtShell()
{
- SwView *pActive = ::GetActiveView();
- if( pActive )
+ if (SwView *pActive = GetActiveView())
return &pActive->GetWrtShell();
return nullptr;
}