diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-27 10:11:52 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-27 17:25:59 +0100 |
commit | 9fcef57a34dbd88a98621dfaf8668fa076dd98f1 (patch) | |
tree | 844e9ca54e0b30faf1b71b42397b4a8143460a43 /sw | |
parent | aa4548d1f91e15b8711bbcbd2ad939247579f9a8 (diff) |
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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/UIConfig_swriter.mk | 1 | ||||
-rw-r--r-- | sw/inc/helpids.h | 4 | ||||
-rw-r--r-- | sw/inc/strings.hrc | 5 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 26 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewling.cxx | 6 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/queryredlinedialog.ui | 83 |
6 files changed, 95 insertions, 30 deletions
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> |