From 9fcef57a34dbd88a98621dfaf8668fa076dd98f1 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 27 Feb 2018 10:11:52 +0000 Subject: convert Redline warning dialog to .ui to get helpids MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit etc. Change-Id: Ic5e6031fe99347f19002d5d8527b5632333fefb0 Reviewed-on: https://gerrit.libreoffice.org/50431 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- 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 ++++++++++++++++++++++++++++ 6 files changed, 95 insertions(+), 30 deletions(-) create mode 100644 sw/uiconfig/swriter/ui/queryredlinedialog.ui (limited to 'sw') 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 #include #include +#include #include +#include #include #include #include @@ -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 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 xBuilder(Application::CreateBuilder(pWin, "modules/swriter/ui/queryredlinedialog.ui")); + std::unique_ptr 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 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( nullptr, MessBoxStyle::Ok, 0, SwResId( STR_HYPH_TITLE ), - SwResId( STR_MULT_INTERACT_HYPH_WARN ) )->Execute(); + std::unique_ptr 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 @@ + + + + + + False + Delete this theme? + False + dialog + True + question + AutoCorrect completed. + You can accept or reject all changes, +or accept or reject particular changes. + + + False + vertical + 12 + + + False + + + Reject All + True + True + True + + + True + True + 0 + + + + + Accept All + True + True + True + True + True + True + + + True + True + 1 + + + + + Edit Changes + True + True + True + + + True + True + 2 + + + + + False + False + 0 + + + + + + cancel + ok + edit + + + + + + -- cgit v1.2.3