tdf#58518: add message in case of not text file with "Insert->File" in Writer

Change-Id: I5d3d6153cdb58485043e80331e0b4f1e55a03412
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99941
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc
index f27cd4d..796418e 100644
--- a/include/sfx2/strings.hrc
+++ b/include/sfx2/strings.hrc
@@ -165,6 +165,7 @@
#define RID_SVXSTR_GRFILTER_FORMATERROR         NC_("RID_SVXSTR_GRFILTER_FORMATERROR", "Unknown image format")
#define RID_SVXSTR_GRFILTER_VERSIONERROR        NC_("RID_SVXSTR_GRFILTER_VERSIONERROR", "This version of the image file is not supported")
#define RID_SVXSTR_GRFILTER_FILTERERROR         NC_("RID_SVXSTR_GRFILTER_FILTERERROR", "Image filter not found")
#define RID_SVXSTR_TXTFILTER_FILTERERROR        NC_("RID_SVXSTR_TXTFILTER_FILTERERROR", "This is not a text document")
#define RID_SVXSTR_END_REDLINING_WARNING        NC_("RID_SVXSTR_END_REDLINING_WARNING", "This action will exit the change recording mode.\nNo information about changes will be recorded from now on.\n\nExit change recording mode?\n\n")
#define RID_SVXSTR_INCORRECT_PASSWORD           NC_("RID_SVXSTR_INCORRECT_PASSWORD", "Incorrect password")
#define RID_SVXSTR_GPG_ENCRYPT_FAILURE          NC_("RID_SVXSTR_GPG_ENCRYPT_FAILURE", "OpenPGP key not trusted, damaged, or encryption failure. Please try again.")
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 87d0a64..780bfba 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -2537,7 +2537,13 @@ IMPL_LINK( SwView, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void )

    std::unique_ptr<SfxMedium> pMed = m_pViewImpl->CreateMedium();
    if ( !pMed )
    {
        std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(),
                                                      VclMessageType::Info, VclButtonsType::Ok,
                                                      SwResId(RID_SVXSTR_TXTFILTER_FILTERERROR)));
        xInfoBox->run();
        return;
    }

    const sal_uInt16 nSlot = m_pViewImpl->GetRequest()->GetSlot();
    long nFound = InsertMedium( nSlot, std::move(pMed), m_pViewImpl->GetParam() );