tdf#122164: inform user that Base is needed for MailMerge

Change-Id: Id62a2e4cd2d8d8b6aa79e43448513a9791a55d91
Reviewed-on: https://gerrit.libreoffice.org/65302
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index d224701..d2a2ad8 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1302,6 +1302,7 @@

#define STR_QUERY_SPECIAL_FORCED                NC_("STR_QUERY_SPECIAL_FORCED", "Check special regions is deactivated. Check anyway?")
#define STR_NO_MERGE_ENTRY                      NC_("STR_NO_MERGE_ENTRY", "Could not merge documents.")
#define STR_NO_BASE_FOR_MERGE                   NC_("STR_NO_BASE_FOR_MERGE", "%PRODUCTNAME Base component is absent, and it is required to use Mail Merge.")
#define STR_ERR_SRCSTREAM                       NC_("STR_ERR_SRCSTREAM", "The source cannot be loaded.")
#define STR_ERR_NO_FAX                          NC_("STR_ERR_NO_FAX", "No fax printer has been set under Tools/Options/%1/Print.")
#define STR_WEBOPTIONS                          NC_("STR_WEBOPTIONS", "HTML document")
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 5fea962..3c7616a 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -60,10 +60,12 @@
#include <uinums.hxx>
#include <dbconfig.hxx>
#include <mmconfigitem.hxx>
#include <strings.hrc>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdb/TextConnectionSettings.hpp>
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <com/sun/star/task/OfficeRestartManager.hpp>
#include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp>
#include <swabstdlg.hxx>
#include <comphelper/dispatchcommand.hxx>
@@ -417,6 +419,17 @@ void SwMailMergeWizardExecutor::ExecuteMailMergeWizard( const SfxItemSet * pArgs
            SAL_INFO(
                "sw.core",
                "trying to install LibreOffice Base, caught " << e);
            auto xRestartManager
                = css::task::OfficeRestartManager::get(comphelper::getProcessComponentContext());
            if (!xRestartManager->isRestartRequested(false))
            {
                // Base is absent, and could not initiate its install - ask user to do that manually
                // Only show the dialog if restart is not initiated yet
                std::unique_ptr<weld::MessageDialog> xWarnBox(Application::CreateMessageDialog(
                    nullptr, VclMessageType::Info, VclButtonsType::Ok,
                    SwResId(STR_NO_BASE_FOR_MERGE)));
                xWarnBox->run();
            }
        }
        return;
    }