[Libreoffice-commits] core.git: basic/source include/sfx2 sc/inc sc/source sfx2/source sw/inc sw/source sw/uiconfig sw/UIConfig_swriter.mk uui/source

Caolán McNamara caolanm at redhat.com
Tue Feb 27 16:26:23 UTC 2018


 basic/source/runtime/iosys.cxx               |   20 +++---
 include/sfx2/strings.hrc                     |    3 
 sc/inc/validat.hxx                           |    2 
 sc/source/core/data/validat.cxx              |   42 ++++++++-----
 sc/source/ui/app/inputhdl.cxx                |    2 
 sc/source/ui/docshell/dbdocfun.cxx           |   14 ++--
 sc/source/ui/view/dbfunc.cxx                 |   12 ++-
 sc/source/ui/view/dbfunc3.cxx                |   16 +++--
 sc/source/ui/view/spelleng.cxx               |   12 ++-
 sc/source/ui/view/viewfun2.cxx               |   15 ++--
 sfx2/source/dialog/filedlghelper.cxx         |    9 +-
 sw/UIConfig_swriter.mk                       |    1 
 sw/inc/helpids.h                             |    4 -
 sw/inc/strings.hrc                           |    5 -
 sw/source/uibase/shells/textsh1.cxx          |   26 ++------
 sw/source/uibase/uiview/viewling.cxx         |    6 +
 sw/uiconfig/swriter/ui/queryredlinedialog.ui |   83 +++++++++++++++++++++++++++
 uui/source/iahndl.cxx                        |   63 +++++++++-----------
 uui/source/secmacrowarnings.hxx              |    1 
 19 files changed, 212 insertions(+), 124 deletions(-)

New commits:
commit 9fcef57a34dbd88a98621dfaf8668fa076dd98f1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 27 10:11:52 2018 +0000

    convert Redline warning dialog to .ui to get helpids
    
    etc.
    
    Change-Id: Ic5e6031fe99347f19002d5d8527b5632333fefb0
    Reviewed-on: https://gerrit.libreoffice.org/50431
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 49932c9e8316..76acd11775a9 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -21,8 +21,8 @@
 #include <vcl/dialog.hxx>
 #include <vcl/edit.hxx>
 #include <vcl/button.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <osl/file.hxx>
 #include <tools/urlobj.hxx>
 
@@ -720,12 +720,10 @@ void SbiIoSystem::Shutdown()
     // anything left to PRINT?
     if( !aOut.isEmpty() )
     {
-#if defined __GNUC__
         vcl::Window* pParent = Application::GetDefDialogParent();
-        ScopedVclPtrInstance<MessBox>( pParent, MessBoxStyle::Ok, 0, OUString(), aOut )->Execute();
-#else
-        ScopedVclPtrInstance<MessBox>( Application::GetDefDialogParent(), MessBoxStyle::Ok, 0, OUString(), aOut )->Execute();
-#endif
+        std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, VclMessageType::Warning,
+            VclButtonsType::Ok, aOut));
+        xBox->run();
     }
     aOut.clear();
 }
@@ -860,10 +858,12 @@ void SbiIoSystem::WriteCon(const OUString& rText)
         }
         {
             SolarMutexGuard aSolarGuard;
-            if( !ScopedVclPtrInstance<MessBox>(
-                        Application::GetDefDialogParent(),
-                        MessBoxStyle::OkCancel | MessBoxStyle::DefaultOk,
-                        0, OUString(), s)->Execute() )
+
+            vcl::Window* pParent = Application::GetDefDialogParent();
+            std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, VclMessageType::Warning,
+                VclButtonsType::OkCancel, s));
+            xBox->set_default_response(RET_OK);
+            if (!xBox->run())
             {
                 nError = ERRCODE_BASIC_USER_ABORT;
             }
diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc
index c36a37b4893a..4e8346b209a5 100644
--- a/include/sfx2/strings.hrc
+++ b/include/sfx2/strings.hrc
@@ -305,6 +305,9 @@
 #define STR_CLEAR_CHAR                          NC_("STR_CLEAR_CHAR", "Remove")
 #define STR_CLEAR_ALL_CHAR                      NC_("STR_CLEAR_ALL_CHAR", "Clear All")
 
+#define STR_PASSWORD_LEN                        NC_("STR_PASSWORD_LEN", "Password length")
+#define STR_PASSWORD_WARNING                    NC_("STR_PASSWORD_WARNING", "The password you have entered causes interoperability issues. Please enter a password that is shorter than 52 bytes, or longer than 55 bytes.")
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx
index d1cb884ca756..bc13663a7e6d 100644
--- a/sc/inc/validat.hxx
+++ b/sc/inc/validat.hxx
@@ -135,7 +135,7 @@ public:
     bool IsDataValid( ScRefCellValue& rCell, const ScAddress& rPos ) const;
 
                     // TRUE -> break
-    bool DoError( vcl::Window* pParent, const OUString& rInput, const ScAddress& rPos ) const;
+    bool DoError(weld::Window* pParent, const OUString& rInput, const ScAddress& rPos) const;
     void DoCalcError( ScFormulaCell* pCell ) const;
 
     bool IsEmpty() const;
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 5eb776843018..afd69531c6ef 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -374,11 +374,11 @@ void ScValidationData::DoCalcError( ScFormulaCell* pCell ) const
 
     // true -> abort
 
-bool ScValidationData::DoError( vcl::Window* pParent, const OUString& rInput,
-                                const ScAddress& rPos ) const
+bool ScValidationData::DoError(weld::Window* pParent, const OUString& rInput,
+                               const ScAddress& rPos) const
 {
     if ( eErrorStyle == SC_VALERR_MACRO )
-        return DoMacro( rPos, rInput, nullptr, pParent ? pParent->GetFrameWeld() : nullptr);
+        return DoMacro(rPos, rInput, nullptr, pParent);
 
     //  Output error message
 
@@ -389,29 +389,39 @@ bool ScValidationData::DoError( vcl::Window* pParent, const OUString& rInput,
     if (aMessage.isEmpty())
         aMessage = ScGlobal::GetRscString( STR_VALID_DEFERROR );
 
-    //TODO: ErrorBox / WarningBox / InfoBox ?
-    //TODO: (with InfoBox always OK-Button only)
-
-    MessBoxStyle nStyle = MessBoxStyle::NONE;
+    VclButtonsType eStyle = VclButtonsType::Ok;
+    VclMessageType eType = VclMessageType::Error;
     switch (eErrorStyle)
     {
-        case SC_VALERR_STOP:
-            nStyle = MessBoxStyle::Ok | MessBoxStyle::DefaultOk;
+        case SC_VALERR_INFO:
+            eType = VclMessageType::Info;
+            eStyle = VclButtonsType::OkCancel;
             break;
         case SC_VALERR_WARNING:
-            nStyle = MessBoxStyle::OkCancel | MessBoxStyle::DefaultCancel;
+            eType = VclMessageType::Warning;
+            eStyle = VclButtonsType::OkCancel;
+            break;
+        default:
             break;
+    }
+
+    std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, eType,
+                                              eStyle, aMessage));
+    xBox->set_title(aTitle);
+
+    switch (eErrorStyle)
+    {
         case SC_VALERR_INFO:
-            nStyle = MessBoxStyle::OkCancel | MessBoxStyle::DefaultOk;
+            xBox->set_default_response(RET_OK);
+            break;
+        case SC_VALERR_WARNING:
+            xBox->set_default_response(RET_CANCEL);
             break;
         default:
-        {
-            // added to avoid warnings
-        }
+            break;
     }
 
-    ScopedVclPtrInstance< MessBox > aBox( pParent, nStyle, 0, aTitle, aMessage );
-    sal_uInt16 nRet = aBox->Execute();
+    short nRet = xBox->run();
 
     return ( eErrorStyle == SC_VALERR_STOP || nRet == RET_CANCEL );
 }
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index bff453de38cd..b78a2a18c1c4 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2670,7 +2670,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
                 else
                     pParent = Application::GetDefDialogParent();
 
-                if ( pData->DoError( pParent, aString, aCursorPos ) )
+                if (pData->DoError(pParent ? pParent->GetFrameWeld() : nullptr, aString, aCursorPos))
                     bForget = true;                 // Do not take over input
             }
         }
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 841b1c792486..c81d66554003 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <sfx2/app.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/weld.hxx>
 #include <vcl/waitobj.hxx>
 #include <svx/dataaccessdescriptor.hxx>
@@ -1008,14 +1007,17 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
 
     bool bOk = true;
     if (rParam.bReplace)
+    {
         if (rDoc.TestRemoveSubTotals( nTab, rParam ))
         {
-            bOk = ScopedVclPtrInstance<MessBox>( ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, 0,
-                        // "StarCalc" "Delete Data?"
-                        ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),
-                        ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_1 ) )->Execute()
-                   == RET_YES;
+            vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
+            std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                      VclMessageType::Question,
+                                                      VclButtonsType::YesNo, ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_1))); // "Delete Data?"
+            xBox->set_title(ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_0)); // "StarCalc"
+            bOk = xBox->run() == RET_YES;
         }
+    }
 
     if (bOk)
     {
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index f72d8bdecb35..b59c5a2cea04 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -20,7 +20,6 @@
 #include <scitems.hxx>
 #include <sfx2/app.hxx>
 #include <sfx2/bindings.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/weld.hxx>
 
 #include <com/sun/star/sdbc/XResultSet.hpp>
@@ -339,10 +338,13 @@ void ScDBFunc::ToggleAutoFilter()
         {
             if (!bHeader)
             {
-                if ( ScopedVclPtrInstance<MessBox>( GetViewData().GetDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, 0,
-                        ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),       // "StarCalc"
-                        ScGlobal::GetRscString( STR_MSSG_MAKEAUTOFILTER_0 )     // header from first row?
-                    )->Execute() == RET_YES )
+                vcl::Window* pWin = GetViewData().GetDialogParent();
+                std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                          VclMessageType::Question,
+                                                          VclButtonsType::YesNo, ScGlobal::GetRscString(STR_MSSG_MAKEAUTOFILTER_0))); // header from first row?
+                xBox->set_title(ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_0)); // "StarCalc"
+                xBox->set_default_response(RET_YES);
+                if (xBox->run() == RET_YES)
                 {
                     pDBData->SetHeader( true );     //! Undo ??
                 }
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 91f3a68a6bac..dd81e409baca 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -21,8 +21,8 @@
 #include <scitems.hxx>
 #include <sfx2/bindings.hxx>
 #include <vcl/svapp.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/waitobj.hxx>
+#include <vcl/weld.hxx>
 #include <svl/zforlist.hxx>
 #include <sfx2/app.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -418,14 +418,18 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord,
     WaitObject aWait( GetViewData().GetDialogParent() );
     bool bOk = true;
     if (rParam.bReplace)
+    {
         if (rDoc.TestRemoveSubTotals( nTab, rParam ))
         {
-            bOk = ScopedVclPtrInstance<MessBox>( GetViewData().GetDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, 0,
-                            // "StarCalc" "delete data?"
-                            ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),
-                            ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_1 ) )->Execute()
-                    == RET_YES;
+            vcl::Window* pWin = GetViewData().GetDialogParent();
+            std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                      VclMessageType::Question, VclButtonsType::YesNo,
+                                                      ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_1))); // "delete data?"
+            xBox->set_title(ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_0)); // "StarCalc"
+            xBox->set_default_response(RET_YES);
+            bOk = xBox->run() == RET_YES;
         }
+    }
 
     if (bOk)
     {
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index 9e39ea9dfa61..7ef031f2c8c4 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -29,7 +29,6 @@
 #include <sfx2/viewfrm.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/weld.hxx>
 
 #include <spelldialog.hxx>
@@ -307,10 +306,13 @@ bool ScSpellingEngine::ShowTableWrapDialog()
 {
     vcl::Window* pParent = GetDialogParent();
     ScWaitCursorOff aWaitOff( pParent );
-    ScopedVclPtrInstance<MessBox> aMsgBox( pParent, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, 0,
-        ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),
-        ScGlobal::GetRscString( STR_SPELLING_BEGIN_TAB) );
-    return aMsgBox->Execute() == RET_YES;
+
+    std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr,
+                                              VclMessageType::Question, VclButtonsType::YesNo,
+                                              ScGlobal::GetRscString(STR_SPELLING_BEGIN_TAB))); // "delete data?"
+    xBox->set_title(ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_0));
+    xBox->set_default_response(RET_YES);
+    return xBox->run() == RET_YES;
 }
 
 void ScSpellingEngine::ShowFinishDialog()
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index de917324290e..5198708574d0 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -35,7 +35,8 @@
 #include <svl/zforlist.hxx>
 #include <svx/srchdlg.hxx>
 #include <svx/svdview.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <vcl/waitobj.hxx>
 
 #include <basic/sbstar.hxx>
@@ -2058,12 +2059,12 @@ void ScViewFunc::Solve( const ScSolveParam& rParam )
             aMsgStr += ScGlobal::GetRscString( STR_MSSG_SOLVE_4 );
         }
 
-        ScopedVclPtrInstance<MessBox> aBox( GetViewData().GetDialogParent(),
-                        MessBoxStyle::YesNo | MessBoxStyle::DefaultNo, 0,
-                        ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), aMsgStr );
-        sal_uInt16 nRetVal = aBox->Execute();
-
-        if ( RET_YES == nRetVal )
+        vcl::Window* pWin = GetViewData().GetDialogParent();
+        std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                  VclMessageType::Question, VclButtonsType::YesNo, aMsgStr));
+        xBox->set_title(ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_0));
+        xBox->set_default_response(RET_NO);
+        if (xBox->run() == RET_NO)
             EnterValue( nDestCol, nDestRow, nDestTab, nSolveResult );
 
         GetViewData().GetViewShell()->UpdateInputHandler( true );
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 32249bd1db6b..33404ae1ca2d 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -2692,10 +2692,11 @@ ErrCode RequestPassword(const std::shared_ptr<const SfxFilter>& pCurrentFilter,
         {
             break;
         }
-        ScopedVclPtrInstance<MessBox>(Application::GetDefDialogParent(),
-            MessBoxStyle::Ok, 0, "Password length",
-            "The password you have entered causes interoperability issues. Please enter a password that is shorter than 52 bytes, or longer than 55 bytes."
-            )->Execute();
+        vcl::Window* pWin = Application::GetDefDialogParent();
+        std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, VclMessageType::Warning,
+            VclButtonsType::Ok, SfxResId(STR_PASSWORD_LEN)));
+        xBox->set_secondary_text(SfxResId(STR_PASSWORD_WARNING));
+        xBox->run();
     }
     while (true);
     if ( pPasswordRequest->isPassword() )
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 9d5a8a811ad9..c518b76d8234 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -194,6 +194,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/querycontinuebegindialog \
 	sw/uiconfig/swriter/ui/querycontinueenddialog \
 	sw/uiconfig/swriter/ui/querydefaultcompatdialog \
+	sw/uiconfig/swriter/ui/queryredlinedialog \
 	sw/uiconfig/swriter/ui/queryrotateintostandarddialog \
 	sw/uiconfig/swriter/ui/querysavelabeldialog \
 	sw/uiconfig/swriter/ui/queryshowchangesdialog \
diff --git a/sw/inc/helpids.h b/sw/inc/helpids.h
index cd7028624ea7..fc1fe83aa446 100644
--- a/sw/inc/helpids.h
+++ b/sw/inc/helpids.h
@@ -99,10 +99,6 @@
 // More Help-IDs
 #define HID_EDIT_FORMULA                                        "SW_HID_EDIT_FORMULA"
 
-#define HID_AUTOFORMAT_REJECT                                   "SW_HID_AUTOFORMAT_REJECT"
-#define HID_AUTOFORMAT_ACCEPT                                   "SW_HID_AUTOFORMAT_ACCEPT"
-#define HID_AUTOFORMAT_EDIT_CHG                                 "SW_HID_AUTOFORMAT_EDIT_CHG"
-
 #define HID_AUTH_FIELD_IDENTIFIER                               "SW_HID_AUTH_FIELD_IDENTIFIER"
 #define HID_AUTH_FIELD_AUTHORITY_TYPE                           "SW_HID_AUTH_FIELD_AUTHORITY_TYPE"
 #define HID_AUTH_FIELD_ADDRESS                                  "SW_HID_AUTH_FIELD_ADDRESS"
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index b00b04bfdfcb..4144f809cd96 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1206,11 +1206,6 @@
 #define STR_REDLINE_FORMATED                    NC_("STR_REDLINE_FORMATED", "Formats")
 #define STR_REDLINE_TABLECHG                    NC_("STR_REDLINE_TABLECHG", "Table Changes")
 #define STR_REDLINE_FMTCOLLSET                  NC_("STR_REDLINE_FMTCOLLSET", "Applied Paragraph Styles")
-#define STR_REDLINE_TITLE                       NC_("STR_REDLINE_TITLE", "AutoCorrect")
-#define STR_REDLINE_MSG                         NC_("STR_REDLINE_MSG", "AutoCorrect completed.\nYou can accept or reject all changes,\nor accept or reject particular changes.")
-#define STR_REDLINE_ACCEPT_ALL                  NC_("STR_REDLINE_ACCEPT_ALL", "Accept All")
-#define STR_REDLINE_REJECT_ALL                  NC_("STR_REDLINE_REJECT_ALL", "Reject All")
-#define STR_REDLINE_EDIT                        NC_("STR_REDLINE_EDIT", "Edit Changes")
 #define STR_PAGE                                NC_("STR_PAGE", "Page ")
 #define STR_PAGE_COUNT                          NC_("STR_PAGE_COUNT", "Page %1 of %2")
 #define STR_PAGE_COUNT_CUSTOM                   NC_("STR_PAGE_COUNT_CUSTOM", "Page %1 of %2 (Page %3)")
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 3641c4c89978..e5d96d77e795 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -38,7 +38,9 @@
 #include <sfx2/bindings.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/objitem.hxx>
+#include <vcl/svapp.hxx>
 #include <vcl/unohelp2.hxx>
+#include <vcl/weld.hxx>
 #include <sfx2/request.hxx>
 #include <svl/eitem.hxx>
 #include <svl/macitem.hxx>
@@ -273,25 +275,11 @@ static void sw_CharDialogResult(const SfxItemSet* pSet, SwWrtShell &rWrtSh, std:
 
 }
 
-static short lcl_AskRedlineFlags(vcl::Window *pWin)
+static short lcl_AskRedlineFlags(weld::Window *pWin)
 {
-    ScopedVclPtrInstance<MessBox> aQBox( pWin, MessBoxStyle::NONE, 0,
-                    SwResId( STR_REDLINE_TITLE ),
-                    SwResId( STR_REDLINE_MSG ) );
-    aQBox->SetImage(GetStandardQueryBoxImage());
-    const ButtonDialogFlags nBtnFlags = ButtonDialogFlags::Default |
-                        ButtonDialogFlags::OK |
-                        ButtonDialogFlags::Focus;
-
-    aQBox->AddButton(SwResId(STR_REDLINE_ACCEPT_ALL), RET_OK, nBtnFlags);
-    aQBox->GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT);
-    aQBox->AddButton(SwResId(STR_REDLINE_REJECT_ALL), RET_CANCEL, ButtonDialogFlags::Cancel);
-    aQBox->GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT  );
-    aQBox->AddButton(SwResId(STR_REDLINE_EDIT), 2);
-    aQBox->GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG);
-    aQBox->SetButtonHelpText( RET_OK, OUString() );
-
-    return aQBox->Execute();
+    std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin, "modules/swriter/ui/queryredlinedialog.ui"));
+    std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QueryRedlineDialog"));
+    return xQBox->run();
 }
 
 static void sw_ParagraphDialogResult(SfxItemSet* pSet, SwWrtShell &rWrtSh, SfxRequest& rReq, SwPaM* pPaM)
@@ -741,7 +729,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
             ScopedVclPtr<AbstractSwModalRedlineAcceptDlg> pDlg(pFact->CreateSwModalRedlineAcceptDlg(&GetView().GetEditWin()));
             OSL_ENSURE(pDlg, "Dialog creation failed!");
 
-            switch (lcl_AskRedlineFlags(&GetView().GetEditWin()))
+            switch (lcl_AskRedlineFlags(GetView().GetEditWin().GetFrameWeld()))
             {
                 case RET_OK:
                 {
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index 4f2191f4027e..f8724e5743c9 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -406,8 +406,10 @@ void SwView::HyphenateDocument()
     // do not hyphenate if interactive hyphenation is active elsewhere
     if (SwEditShell::HasHyphIter())
     {
-        ScopedVclPtrInstance<MessBox>( nullptr, MessBoxStyle::Ok, 0, SwResId( STR_HYPH_TITLE ),
-                                       SwResId( STR_MULT_INTERACT_HYPH_WARN ) )->Execute();
+        std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, VclMessageType::Warning,
+            VclButtonsType::Ok, SwResId(STR_MULT_INTERACT_HYPH_WARN)));
+        xBox->set_title(SwResId(STR_HYPH_TITLE));
+        xBox->run();
         return;
     }
 
diff --git a/sw/uiconfig/swriter/ui/queryredlinedialog.ui b/sw/uiconfig/swriter/ui/queryredlinedialog.ui
new file mode 100644
index 000000000000..47ecdabbc956
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/queryredlinedialog.ui
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.2 -->
+<interface domain="sw">
+  <requires lib="gtk+" version="3.0"/>
+  <object class="GtkMessageDialog" id="QueryRedlineDialog">
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes" context="queryredlinedialog|QueryRedlineDialog">Delete this theme?</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="message_type">question</property>
+    <property name="text" translatable="yes" context="queryredlinedialog|QueryRedlineDialog">AutoCorrect completed.</property>
+    <property name="secondary_text" translatable="yes" context="queryredlinedialog|QueryRedlineDialog">You can accept or reject all changes,
+or accept or reject particular changes.</property>
+    <child internal-child="vbox">
+      <object class="GtkBox">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox">
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label" translatable="yes" context="queryredlinedialog|cancel">Reject All</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label" translatable="yes" context="queryredlinedialog|ok">Accept All</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="has_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="edit">
+                <property name="label" translatable="yes" context="queryredlinedialog|edit">Edit Changes</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancel</action-widget>
+      <action-widget response="-5">ok</action-widget>
+      <action-widget response="2">edit</action-widget>
+    </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
+  </object>
+</interface>
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index b45b9cea2c2d..228ff20af632 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -63,13 +63,13 @@
 #include <osl/conditn.hxx>
 #include <unotools/resmgr.hxx>
 #include <vcl/errinf.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <osl/thread.hxx>
 #include <tools/diagnose_ex.h>
 #include <comphelper/documentconstants.hxx>
 #include <comphelper/propertysequence.hxx>
 #include <svtools/sfxecode.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/svapp.hxx>
 #include <unotools/configmgr.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <comphelper/processfactory.hxx>
@@ -965,36 +965,35 @@ namespace {
 
 DialogMask
 executeMessageBox(
-    vcl::Window * pParent,
+    weld::Window * pParent,
     OUString const & rTitle,
     OUString const & rMessage,
-    MessBoxStyle nButtonMask)
+    VclMessageType eMessageType)
 {
     SolarMutexGuard aGuard;
-    WinBits nStyle(0);
 
-    ScopedVclPtrInstance< MessBox > xBox(pParent, nButtonMask, nStyle, rTitle, rMessage);
+    std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, eMessageType,
+        eMessageType == VclMessageType::Question ? VclButtonsType::YesNo : VclButtonsType::Ok, rMessage));
+    xBox->set_title(rTitle);
 
-    sal_uInt16 aMessResult = xBox->Execute();
+    short nMessResult = xBox->run();
     DialogMask aResult = DialogMask::NONE;
-    switch( aMessResult )
+    switch (nMessResult)
     {
-    case RET_OK:
-        aResult = DialogMask::ButtonsOk;
-        break;
-    case RET_CANCEL:
-        aResult = DialogMask::ButtonsCancel;
-        break;
-    case RET_YES:
-        aResult = DialogMask::ButtonsYes;
-        break;
-    case RET_NO:
-        aResult = DialogMask::ButtonsNo;
-        break;
-    case RET_RETRY:
-        aResult = DialogMask::ButtonsRetry;
-        break;
-    default: assert(false);
+        case RET_OK:
+            aResult = DialogMask::ButtonsOk;
+            break;
+        case RET_CANCEL:
+            aResult = DialogMask::ButtonsCancel;
+            break;
+        case RET_YES:
+            aResult = DialogMask::ButtonsYes;
+            break;
+        case RET_NO:
+            aResult = DialogMask::ButtonsNo;
+            break;
+        default:
+            assert(false);
     }
 
     return aResult;
@@ -1117,7 +1116,8 @@ UUIInteractionHelper::handleGenericErrorRequest(
                 aTitle += " - " ;
             aTitle += aErrTitle;
 
-            executeMessageBox(getParentProperty(), aTitle, aErrorString, MessBoxStyle::Ok);
+            vcl::Window* pWin = getParentProperty();
+            executeMessageBox(pWin ? pWin->GetFrameWeld() : nullptr, aTitle, aErrorString, VclMessageType::Error);
         }
         else
         {
@@ -1218,15 +1218,11 @@ UUIInteractionHelper::handleBrokenPackageRequest(
         return;
     }
 
-    MessBoxStyle nButtonMask;
+    VclMessageType eMessageType;
     if( xApprove.is() && xDisapprove.is() )
-    {
-        nButtonMask = MessBoxStyle::YesNo | MessBoxStyle::DefaultYes;
-    }
+        eMessageType = VclMessageType::Question;
     else if ( xAbort.is() )
-    {
-        nButtonMask = MessBoxStyle::Ok;
-    }
+        eMessageType = VclMessageType::Warning;
     else
         return;
 
@@ -1235,7 +1231,8 @@ UUIInteractionHelper::handleBrokenPackageRequest(
         " " +
         utl::ConfigManager::getProductVersion() );
 
-    switch (executeMessageBox(getParentProperty(), title, aMessage, nButtonMask))
+    vcl::Window* pWin = getParentProperty();
+    switch (executeMessageBox(pWin ? pWin->GetFrameWeld() : nullptr, title, aMessage, eMessageType))
     {
     case DialogMask::ButtonsOk:
         OSL_ENSURE( xAbort.is(), "unexpected situation" );
diff --git a/uui/source/secmacrowarnings.hxx b/uui/source/secmacrowarnings.hxx
index 62517709d66b..8a34d90ffd9c 100644
--- a/uui/source/secmacrowarnings.hxx
+++ b/uui/source/secmacrowarnings.hxx
@@ -23,6 +23,7 @@
 #include <vcl/dialog.hxx>
 #include <unotools/securityoptions.hxx>
 #include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 
 namespace com {


More information about the Libreoffice-commits mailing list