Resolves tdf#148815 - Make SAL_NO_QUERYSAVE work for SID_RELOAD

Change-Id: Ic23fd7294d1ec8b06f415ea6744190cf2ffe3ae2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134858
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index b43a907..43c1112 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -633,12 +633,14 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
            // If possible ask the User
            bool bDo = GetViewShell()->PrepareClose();
            const SfxBoolItem* pSilentItem = rReq.GetArg<SfxBoolItem>(SID_SILENT);
            if ( bDo && GetFrame().DocIsModified_Impl() &&
                 !rReq.IsAPI() && ( !pSilentItem || !pSilentItem->GetValue() ) )
            if (getenv("SAL_NO_QUERYSAVE"))
                bDo = true;
            else if (bDo && GetFrame().DocIsModified_Impl() && !rReq.IsAPI()
                     && (!pSilentItem || !pSilentItem->GetValue()))
            {
                std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetWindow().GetFrameWeld(),
                                                                         VclMessageType::Question, VclButtonsType::YesNo,
                                                                         SfxResId(STR_QUERY_LASTVERSION)));
                std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(
                    GetWindow().GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
                    SfxResId(STR_QUERY_LASTVERSION)));
                bDo = RET_YES == xBox->run();
            }