diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-12-03 16:27:28 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-12-04 09:54:39 +0100 |
commit | 486268cc87907a399649bd4612078031dce262d4 (patch) | |
tree | c4476a8715ea4a7cded6de70508ab8959a363ab2 | |
parent | a89e8c54e8aa95e7f59f204cc3396e2acbdd860a (diff) |
weld OfaAutoCorrDlg
Change-Id: Iba217a2998de57bf963872f9b8c1cf38694eb935
Reviewed-on: https://gerrit.libreoffice.org/64476
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 5 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 2 | ||||
-rw-r--r-- | cui/source/inc/autocdlg.hxx | 14 | ||||
-rw-r--r-- | cui/source/tabpages/autocdlg.cxx | 86 | ||||
-rw-r--r-- | cui/uiconfig/ui/acorexceptpage.ui | 3 | ||||
-rw-r--r-- | cui/uiconfig/ui/acoroptionspage.ui | 3 | ||||
-rw-r--r-- | cui/uiconfig/ui/applyautofmtpage.ui | 3 | ||||
-rw-r--r-- | cui/uiconfig/ui/applylocalizedpage.ui | 4 | ||||
-rw-r--r-- | cui/uiconfig/ui/autocorrectdialog.ui | 212 | ||||
-rw-r--r-- | cui/uiconfig/ui/wordcompletionpage.ui | 17 | ||||
-rw-r--r-- | include/sfx2/sfxdlg.hxx | 2 | ||||
-rw-r--r-- | include/svx/langbox.hxx | 2 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 2 | ||||
-rw-r--r-- | solenv/sanitizers/ui/cui.suppr | 2 | ||||
-rw-r--r-- | svx/source/dialog/langbox.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 48 |
19 files changed, 326 insertions, 99 deletions
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 759b90bc53c6..dd8c8bf1c3d4 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -986,10 +986,9 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateFrameDialog(vcl::Win } // TabDialog outside the drawing layer -VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateAutoCorrTabDialog(vcl::Window* pParent, const SfxItemSet* pAttrSet) +VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateAutoCorrTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet) { - VclPtrInstance<OfaAutoCorrDlg> pDlg(pParent, pAttrSet); - return VclPtr<CuiAbstractTabDialog_Impl>::Create( pDlg ); + return VclPtr<CuiAbstractTabController_Impl>::Create(o3tl::make_unique<OfaAutoCorrDlg>(pParent, pAttrSet)); } VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateCustomizeTabDialog( diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 1e103792893d..cd6dffd9f4e6 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -688,7 +688,7 @@ public: virtual VclPtr<VclAbstractDialog> CreateFrameDialog(vcl::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame, sal_uInt32 nResId, const OUString& rParameter ) override; - virtual VclPtr<SfxAbstractTabDialog> CreateAutoCorrTabDialog(vcl::Window* pParent, const SfxItemSet* pAttrSet) override; + virtual VclPtr<SfxAbstractTabDialog> CreateAutoCorrTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet) override; virtual VclPtr<SfxAbstractTabDialog> CreateCustomizeTabDialog( const SfxItemSet* pAttrSet, const css::uno::Reference< css::frame::XFrame >& xViewFrame ) override; diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx index cc8b5383b7af..465ee0a34498 100644 --- a/cui/source/inc/autocdlg.hxx +++ b/cui/source/inc/autocdlg.hxx @@ -40,20 +40,16 @@ namespace editeng { class SortedAutoCompleteStrings; } // class OfaAutoCorrDlg -------------------------------------------------- -class OfaAutoCorrDlg : public SfxTabDialog +class OfaAutoCorrDlg : public SfxTabDialogController { - VclPtr<VclContainer> m_pLanguageBox; - VclPtr<SvxLanguageBox> m_pLanguageLB; + std::unique_ptr<weld::Widget> m_xLanguageBox; + std::unique_ptr<LanguageBox> m_xLanguageLB; - sal_uInt16 m_nReplacePageId; - sal_uInt16 m_nExceptionsPageId; - - DECL_LINK(SelectLanguageHdl, ListBox&, void); + DECL_LINK(SelectLanguageHdl, weld::ComboBox&, void); public: - OfaAutoCorrDlg(vcl::Window* pParent, const SfxItemSet *pSet); + OfaAutoCorrDlg(weld::Window* pParent, const SfxItemSet *pSet); virtual ~OfaAutoCorrDlg() override; - virtual void dispose() override; void EnableLanguage(bool bEnable); }; diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index fa8825bd3f5a..153d9af05823 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -60,12 +60,11 @@ static LanguageType eLastDialogLanguage = LANGUAGE_SYSTEM; using namespace ::com::sun::star::util; using namespace ::com::sun::star; -OfaAutoCorrDlg::OfaAutoCorrDlg(vcl::Window* pParent, const SfxItemSet* _pSet ) - : SfxTabDialog(pParent, "AutoCorrectDialog", "cui/ui/autocorrectdialog.ui", _pSet) +OfaAutoCorrDlg::OfaAutoCorrDlg(weld::Window* pParent, const SfxItemSet* _pSet ) + : SfxTabDialogController(pParent, "cui/ui/autocorrectdialog.ui", "AutoCorrectDialog", _pSet) + , m_xLanguageBox(m_xBuilder->weld_widget("langbox")) + , m_xLanguageLB(new LanguageBox(m_xBuilder->weld_combo_box("lang"))) { - get(m_pLanguageBox, "langbox"); - get(m_pLanguageLB, "lang"); - bool bShowSWOptions = false; bool bOpenSmartTagOptions = false; @@ -81,13 +80,13 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(vcl::Window* pParent, const SfxItemSet* _pSet ) } AddTabPage("options", OfaAutocorrOptionsPage::Create, nullptr); - AddTabPage("apply", OfaSwAutoFmtOptionsPage::Create, nullptr); + AddTabPage("applypage", OfaSwAutoFmtOptionsPage::Create, nullptr); AddTabPage("wordcompletion", OfaAutoCompleteTabPage::Create, nullptr); AddTabPage("smarttags", OfaSmartTagOptionsTabPage::Create, nullptr); if (!bShowSWOptions) { - RemoveTabPage("apply"); + RemoveTabPage("applypage"); RemoveTabPage("wordcompletion"); RemoveTabPage("smarttags"); } @@ -102,8 +101,8 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(vcl::Window* pParent, const SfxItemSet* _pSet ) RemoveTabPage("options"); } - m_nReplacePageId = AddTabPage("replace", OfaAutocorrReplacePage::Create, nullptr); - m_nExceptionsPageId = AddTabPage("exceptions", OfaAutocorrExceptPage::Create, nullptr); + AddTabPage("replace", OfaAutocorrReplacePage::Create, nullptr); + AddTabPage("exceptions", OfaAutocorrExceptPage::Create, nullptr); AddTabPage("localized", OfaQuoteTabPage::Create, nullptr); // initialize languages @@ -115,23 +114,23 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(vcl::Window* pParent, const SfxItemSet* _pSet ) nLangList |= SvxLanguageListFlags::CTL; if( SvtLanguageOptions().IsCJKFontEnabled() ) nLangList |= SvxLanguageListFlags::CJK; - m_pLanguageLB->SetLanguageList( nLangList, true, true ); - m_pLanguageLB->SelectLanguage( LANGUAGE_NONE ); - sal_Int32 nPos = m_pLanguageLB->GetSelectedEntryPos(); - DBG_ASSERT( LISTBOX_ENTRY_NOTFOUND != nPos, "listbox entry missing" ); - m_pLanguageLB->SetEntryData( nPos, reinterpret_cast<void*>(static_cast<sal_uInt16>(LANGUAGE_UNDETERMINED)) ); + m_xLanguageLB->SetLanguageList( nLangList, true, true ); + m_xLanguageLB->set_active_id( LANGUAGE_NONE ); + int nPos = m_xLanguageLB->get_active(); + DBG_ASSERT(nPos != -1, "listbox entry missing" ); + m_xLanguageLB->set_id(nPos, LANGUAGE_UNDETERMINED); // Initializing doesn't work for static on linux - therefore here - if( LANGUAGE_SYSTEM == eLastDialogLanguage ) + if (LANGUAGE_SYSTEM == eLastDialogLanguage) eLastDialogLanguage = Application::GetSettings().GetLanguageTag().getLanguageType(); LanguageType nSelectLang = LANGUAGE_UNDETERMINED; - nPos = m_pLanguageLB->GetEntryPos( reinterpret_cast<void*>(static_cast<sal_uInt16>(eLastDialogLanguage)) ); - if (LISTBOX_ENTRY_NOTFOUND != nPos) + nPos = m_xLanguageLB->find_id(eLastDialogLanguage); + if (nPos != -1) nSelectLang = eLastDialogLanguage; - m_pLanguageLB->SelectLanguage( nSelectLang ); + m_xLanguageLB->set_active_id(nSelectLang); - m_pLanguageLB->SetSelectHdl(LINK(this, OfaAutoCorrDlg, SelectLanguageHdl)); + m_xLanguageLB->connect_changed(LINK(this, OfaAutoCorrDlg, SelectLanguageHdl)); if ( bOpenSmartTagOptions ) SetCurPageId("smarttags"); @@ -139,19 +138,11 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(vcl::Window* pParent, const SfxItemSet* _pSet ) OfaAutoCorrDlg::~OfaAutoCorrDlg() { - disposeOnce(); -} - -void OfaAutoCorrDlg::dispose() -{ - m_pLanguageBox.clear(); - m_pLanguageLB.clear(); - SfxTabDialog::dispose(); } void OfaAutoCorrDlg::EnableLanguage(bool bEnable) { - m_pLanguageBox->Enable(bEnable); + m_xLanguageBox->set_sensitive(bEnable); } static bool lcl_FindEntry(weld::TreeView& rLB, const OUString& rEntry, @@ -172,19 +163,17 @@ static bool lcl_FindEntry(weld::TreeView& rLB, const OUString& rEntry, return false; } -IMPL_LINK(OfaAutoCorrDlg, SelectLanguageHdl, ListBox&, rBox, void) +IMPL_LINK_NOARG(OfaAutoCorrDlg, SelectLanguageHdl, weld::ComboBox&, void) { - sal_Int32 nPos = rBox.GetSelectedEntryPos(); - void* pVoid = rBox.GetEntryData(nPos); - LanguageType eNewLang = LanguageType(reinterpret_cast<sal_IntPtr>(pVoid)); + LanguageType eNewLang = m_xLanguageLB->get_active_id(); // save old settings and fill anew if(eNewLang != eLastDialogLanguage) { - sal_uInt16 nPageId = GetCurPageId(); - if (m_nReplacePageId == nPageId) - static_cast<OfaAutocorrReplacePage*>(GetTabPage( nPageId ))->SetLanguage(eNewLang); - else if (m_nExceptionsPageId == nPageId) - static_cast<OfaAutocorrExceptPage*>(GetTabPage( nPageId ))->SetLanguage(eNewLang); + OString sPageId = GetCurPageId(); + if (sPageId == "replace") + static_cast<OfaAutocorrReplacePage*>(GetTabPage(sPageId))->SetLanguage(eNewLang); + else if (sPageId == "exceptions") + static_cast<OfaAutocorrExceptPage*>(GetTabPage(sPageId))->SetLanguage(eNewLang); } } @@ -203,6 +192,7 @@ OfaAutocorrOptionsPage::OfaAutocorrOptionsPage(TabPageParent pParent, const SfxI std::vector<int> aWidths; aWidths.push_back(m_xCheckLB->get_approximate_digit_width() * 3 + 6); m_xCheckLB->set_column_fixed_widths(aWidths); + m_xCheckLB->set_size_request(-1, m_xCheckLB->get_height_rows(10)); } OfaAutocorrOptionsPage::~OfaAutocorrOptionsPage() @@ -243,7 +233,7 @@ bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet* ) void OfaAutocorrOptionsPage::ActivatePage( const SfxItemSet& ) { - static_cast<OfaAutoCorrDlg*>(GetTabDialog())->EnableLanguage(false); + static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage(false); } void OfaAutocorrOptionsPage::InsertEntry(const OUString& rTxt) @@ -532,7 +522,7 @@ bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet* ) void OfaSwAutoFmtOptionsPage::ActivatePage( const SfxItemSet& ) { - static_cast<OfaAutoCorrDlg*>(GetTabDialog())->EnableLanguage(false); + static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage(false); } void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet* ) @@ -785,7 +775,7 @@ OfaAutocorrReplacePage::OfaAutocorrReplacePage(TabPageParent pParent, { sNew = m_xNewReplacePB->get_label(); sModify = m_xReplacePB->get_label(); - m_xReplaceTLB->set_size_request(-1, m_xReplaceTLB->get_height_rows(16)); + m_xReplaceTLB->set_size_request(-1, m_xReplaceTLB->get_height_rows(10)); SfxModule *pMod = SfxApplication::GetModule(SfxToolsModule::Writer); bSWriter = pMod == SfxModule::GetActiveModule(); @@ -835,7 +825,7 @@ void OfaAutocorrReplacePage::ActivatePage( const SfxItemSet& ) { if(eLang != eLastDialogLanguage) SetLanguage(eLastDialogLanguage); - static_cast<OfaAutoCorrDlg*>(GetTabDialog())->EnableLanguage(true); + static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage(true); } DeactivateRC OfaAutocorrReplacePage::DeactivatePage( SfxItemSet* ) @@ -1312,10 +1302,10 @@ OfaAutocorrExceptPage::OfaAutocorrExceptPage(TabPageParent pParent, const SfxIte , m_xAutoCapsCB(m_xBuilder->weld_check_button("autodouble")) { m_xAbbrevLB->make_sorted(); - m_xAbbrevLB->set_size_request(-1, m_xAbbrevLB->get_height_rows(7)); + m_xAbbrevLB->set_size_request(-1, m_xAbbrevLB->get_height_rows(6)); m_xDoubleCapsLB->make_sorted(); - m_xDoubleCapsLB->set_size_request(-1, m_xDoubleCapsLB->get_height_rows(7)); + m_xDoubleCapsLB->set_size_request(-1, m_xDoubleCapsLB->get_height_rows(6)); css::lang::Locale aLcl( LanguageTag::convertToLocale(eLastDialogLanguage )); pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) ); @@ -1357,7 +1347,7 @@ void OfaAutocorrExceptPage::ActivatePage( const SfxItemSet& ) { if(eLang != eLastDialogLanguage) SetLanguage(eLastDialogLanguage); - static_cast<OfaAutoCorrDlg*>(GetTabDialog())->EnableLanguage(true); + static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage(true); } DeactivateRC OfaAutocorrExceptPage::DeactivatePage( SfxItemSet* ) @@ -1791,7 +1781,7 @@ bool OfaQuoteTabPage::FillItemSet( SfxItemSet* ) void OfaQuoteTabPage::ActivatePage( const SfxItemSet& ) { - static_cast<OfaAutoCorrDlg*>(GetTabDialog())->EnableLanguage(false); + static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage(false); } void OfaQuoteTabPage::Reset( const SfxItemSet* ) @@ -2002,7 +1992,7 @@ OfaAutoCompleteTabPage::OfaAutoCompleteTabPage(TabPageParent pParent, } m_xLBEntries->set_size_request(m_xLBEntries->get_approximate_digit_width() * 30, - m_xLBEntries->get_height_rows(20)); + m_xLBEntries->get_height_rows(10)); // the defined KEYs static const sal_uInt16 aKeyCodes[] = { @@ -2153,7 +2143,7 @@ void OfaAutoCompleteTabPage::Reset( const SfxItemSet* ) void OfaAutoCompleteTabPage::ActivatePage( const SfxItemSet& ) { - static_cast<OfaAutoCorrDlg*>(GetTabDialog())->EnableLanguage( false ); + static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage( false ); } IMPL_LINK_NOARG(OfaAutoCompleteTabPage, DeleteHdl, weld::Button&, void) @@ -2442,7 +2432,7 @@ void OfaSmartTagOptionsTabPage::Reset( const SfxItemSet* ) void OfaSmartTagOptionsTabPage::ActivatePage( const SfxItemSet& ) { - static_cast<OfaAutoCorrDlg*>(GetTabDialog())->EnableLanguage( false ); + static_cast<OfaAutoCorrDlg*>(GetDialogController())->EnableLanguage( false ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/uiconfig/ui/acorexceptpage.ui b/cui/uiconfig/ui/acorexceptpage.ui index ee6564171d40..b1568fbd3bed 100644 --- a/cui/uiconfig/ui/acorexceptpage.ui +++ b/cui/uiconfig/ui/acorexceptpage.ui @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> <object class="GtkTreeStore" id="liststore1"> @@ -20,6 +21,8 @@ <object class="GtkBox" id="AcorExceptPage"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="border_width">6</property> <property name="orientation">vertical</property> <property name="spacing">12</property> diff --git a/cui/uiconfig/ui/acoroptionspage.ui b/cui/uiconfig/ui/acoroptionspage.ui index f1da95498d94..5721b2b54b2d 100644 --- a/cui/uiconfig/ui/acoroptionspage.ui +++ b/cui/uiconfig/ui/acoroptionspage.ui @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> <object class="GtkTreeStore" id="liststore2"> @@ -59,7 +60,7 @@ <child> <object class="GtkCellRendererText" id="cellrenderer4"/> <attributes> - <attribute name="text">0</attribute> + <attribute name="text">1</attribute> </attributes> </child> </object> diff --git a/cui/uiconfig/ui/applyautofmtpage.ui b/cui/uiconfig/ui/applyautofmtpage.ui index 35637dc88194..77b179a7fc96 100644 --- a/cui/uiconfig/ui/applyautofmtpage.ui +++ b/cui/uiconfig/ui/applyautofmtpage.ui @@ -38,6 +38,7 @@ <object class="GtkButton" id="edit"> <property name="label" translatable="yes" context="applyautofmtpage|edit">_Edit...</property> <property name="visible">True</property> + <property name="sensitive">False</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="valign">center</property> @@ -141,7 +142,7 @@ <child> <object class="GtkCellRendererText" id="cellrenderer3"/> <attributes> - <attribute name="text">0</attribute> + <attribute name="text">2</attribute> </attributes> </child> </object> diff --git a/cui/uiconfig/ui/applylocalizedpage.ui b/cui/uiconfig/ui/applylocalizedpage.ui index 03dcbce8ba29..7376e74ddfcb 100644 --- a/cui/uiconfig/ui/applylocalizedpage.ui +++ b/cui/uiconfig/ui/applylocalizedpage.ui @@ -100,7 +100,7 @@ <child> <object class="GtkCellRendererText" id="cellrenderer3"/> <attributes> - <attribute name="text">0</attribute> + <attribute name="text">2</attribute> </attributes> </child> </object> @@ -155,7 +155,7 @@ <child> <object class="GtkCellRendererText" id="cellrenderer4"/> <attributes> - <attribute name="text">0</attribute> + <attribute name="text">1</attribute> </attributes> </child> </object> diff --git a/cui/uiconfig/ui/autocorrectdialog.ui b/cui/uiconfig/ui/autocorrectdialog.ui index 6af5cd63f1c2..94a42090f34b 100644 --- a/cui/uiconfig/ui/autocorrectdialog.ui +++ b/cui/uiconfig/ui/autocorrectdialog.ui @@ -1,13 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkDialog" id="AutoCorrectDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="autocorrectdialog|AutoCorrectDialog">AutoCorrect</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -18,12 +23,10 @@ <property name="can_focus">False</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="ok"> - <property name="label">gtk-ok</property> + <object class="GtkButton" id="reset"> + <property name="label">gtk-revert-to-saved</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -34,10 +37,12 @@ </packing> </child> <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -48,8 +53,8 @@ </packing> </child> <child> - <object class="GtkButton" id="help"> - <property name="label">gtk-help</property> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -58,13 +63,12 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> - <property name="secondary">True</property> + <property name="position">2</property> </packing> </child> <child> - <object class="GtkButton" id="reset"> - <property name="label">gtk-revert-to-saved</property> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -73,7 +77,8 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">3</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -101,6 +106,8 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes" context="autocorrectdialog|label1">Replacements and exceptions for language:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">lang</property> <property name="xalign">0</property> </object> <packing> @@ -110,7 +117,7 @@ </packing> </child> <child> - <object class="svxcorelo-SvxLanguageBox" id="lang"> + <object class="GtkComboBoxText" id="lang"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -133,7 +140,6 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="scrollable">True</property> <property name="enable_popup">True</property> <child> <object class="GtkGrid"> @@ -142,6 +148,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> </child> <child type="tab"> @@ -161,6 +191,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">1</property> @@ -184,6 +238,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">2</property> @@ -207,13 +285,37 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">3</property> </packing> </child> <child type="tab"> - <object class="GtkLabel" id="apply"> + <object class="GtkLabel" id="applypage"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes" context="autocorrectdialog|apply">Options</property> @@ -230,6 +332,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">4</property> @@ -253,6 +379,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">5</property> @@ -276,6 +426,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">6</property> @@ -309,10 +483,10 @@ </object> </child> <action-widgets> + <action-widget response="101">reset</action-widget> <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> - <action-widget response="0">reset</action-widget> </action-widgets> </object> </interface> diff --git a/cui/uiconfig/ui/wordcompletionpage.ui b/cui/uiconfig/ui/wordcompletionpage.ui index b54a667ac838..6d38ba3bad65 100644 --- a/cui/uiconfig/ui/wordcompletionpage.ui +++ b/cui/uiconfig/ui/wordcompletionpage.ui @@ -2,6 +2,14 @@ <!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> + <object class="GtkTreeStore" id="liststore2"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> <object class="GtkAdjustment" id="adjustment1"> <property name="lower">50</property> <property name="upper">65535</property> @@ -64,6 +72,7 @@ <property name="receives_default">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="model">liststore2</property> <property name="headers_visible">False</property> <property name="search_column">0</property> <property name="show_expanders">False</property> @@ -367,12 +376,4 @@ <widget name="minwordlen"/> </widgets> </object> - <object class="GtkTreeStore" id="liststore1"> - <columns> - <!-- column-name text --> - <column type="gchararray"/> - <!-- column-name id --> - <column type="gchararray"/> - </columns> - </object> </interface> diff --git a/include/sfx2/sfxdlg.hxx b/include/sfx2/sfxdlg.hxx index c6c7b243f62c..0a5fef9efb87 100644 --- a/include/sfx2/sfxdlg.hxx +++ b/include/sfx2/sfxdlg.hxx @@ -127,7 +127,7 @@ public: virtual ~SfxAbstractDialogFactory() override; // needed for export of vtable static SfxAbstractDialogFactory* Create(); virtual VclPtr<VclAbstractDialog> CreateFrameDialog(vcl::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rFrame, sal_uInt32 nResId, const OUString& rParameter ) = 0; - virtual VclPtr<SfxAbstractTabDialog> CreateAutoCorrTabDialog(vcl::Window* pParent, const SfxItemSet* pAttrSet) = 0; + virtual VclPtr<SfxAbstractTabDialog> CreateAutoCorrTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateCustomizeTabDialog( const SfxItemSet* pAttrSet, const css::uno::Reference< css::frame::XFrame >& xViewFrame ) = 0; diff --git a/include/svx/langbox.hxx b/include/svx/langbox.hxx index 93ab480bf460..7c94d60eaafd 100644 --- a/include/svx/langbox.hxx +++ b/include/svx/langbox.hxx @@ -173,6 +173,8 @@ public: OUString get_active_text() const { return m_xControl->get_active_text(); } bool get_visible() const { return m_xControl->get_visible(); } LanguageType get_active_id() const; + int find_id(const LanguageType eLangType) const; + void set_id(int nPos, const LanguageType eLangType); void remove_id(const LanguageType eLangType); void append(const LanguageType eLangType, const OUString& rStr); int find_text(const OUString& rStr) const { return m_xControl->find_text(rStr); } diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 00d8713d4fd1..028419f117ab 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -362,6 +362,7 @@ public: virtual OUString get_active_id() const = 0; virtual void set_active_id(const OUString& rStr) = 0; virtual OUString get_id(int pos) const = 0; + virtual void set_id(int row, const OUString& rId) = 0; virtual int find_id(const OUString& rId) const = 0; void remove_id(const OUString& rId) { remove(find_id(rId)); } @@ -886,6 +887,7 @@ public: m_xEntry->set_text(m_xTreeView->get_selected_text()); } virtual OUString get_id(int pos) const override { return m_xTreeView->get_id(pos); } + virtual void set_id(int pos, const OUString& rId) override { m_xTreeView->set_id(pos, rId); } virtual int find_id(const OUString& rId) const override { return m_xTreeView->find_id(rId); } //entry related diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 10e2f1776730..d9bf7709d455 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1619,7 +1619,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) aSet.Put( *pItem ); const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateAutoCorrTabDialog(pViewFrame? &pViewFrame->GetWindow(): nullptr, &aSet)); + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateAutoCorrTabDialog(pViewFrame ? pViewFrame->GetWindow().GetFrameWeld() : nullptr, &aSet)); pDlg->Execute(); break; diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr index eaa40081d65c..efe88e89d490 100644 --- a/solenv/sanitizers/ui/cui.suppr +++ b/solenv/sanitizers/ui/cui.suppr @@ -35,8 +35,6 @@ cui/uiconfig/ui/applylocalizedpage.ui://GtkLabel[@id='doublestartex'] orphan-lab cui/uiconfig/ui/applylocalizedpage.ui://GtkLabel[@id='doubleendex'] orphan-label cui/uiconfig/ui/assigncomponentdialog.ui://GtkLabel[@id='label1'] orphan-label cui/uiconfig/ui/assigncomponentdialog.ui://GtkEntry[@id='methodEntry'] no-labelled-by -cui/uiconfig/ui/autocorrectdialog.ui://GtkLabel[@id='label1'] orphan-label -cui/uiconfig/ui/autocorrectdialog.ui://svxcorelo-SvxLanguageBox[@id='lang'] no-labelled-by cui/uiconfig/ui/backgroundpage.ui://GtkLabel[@id='fileft'] orphan-label cui/uiconfig/ui/backgroundpage.ui://GtkLabel[@id='unlinkedft'] orphan-label cui/uiconfig/ui/backgroundpage.ui://GtkLabel[@id='findgraphicsft'] orphan-label diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index a1317ed144f4..9dc829ed6ce1 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -467,6 +467,16 @@ LanguageType LanguageBox::get_active_id() const return LANGUAGE_DONTKNOW; } +int LanguageBox::find_id(const LanguageType eLangType) const +{ + return m_xControl->find_id(OUString::number(static_cast<sal_uInt16>(eLangType))); +} + +void LanguageBox::set_id(int pos, const LanguageType eLangType) +{ + m_xControl->set_id(pos, OUString::number(static_cast<sal_uInt16>(eLangType))); +} + void LanguageBox::remove_id(const LanguageType eLangType) { m_xControl->remove_id(OUString::number(static_cast<sal_uInt16>(eLangType))); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index e4271f9058bb..a13930dba1b3 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -444,7 +444,7 @@ void SwDocShell::Execute(SfxRequest& rReq) aSet.Put( *static_cast<const SfxBoolItem*>(pOpenSmartTagOptionsItem) ); SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - VclPtr<SfxAbstractTabDialog> pDlg = pFact->CreateAutoCorrTabDialog(&GetView()->GetViewFrame()->GetWindow(), &aSet); + VclPtr<SfxAbstractTabDialog> pDlg = pFact->CreateAutoCorrTabDialog(GetView()->GetViewFrame()->GetWindow().GetFrameWeld(), &aSet); pDlg->Execute(); pDlg.disposeAndClear(); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index ca9669531403..6adc7d802775 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -3000,6 +3000,12 @@ public: return *pRet; } + virtual void set_id(int row, const OUString& rId) override + { + m_aUserData.emplace_back(o3tl::make_unique<OUString>(rId)); + m_xComboBox->SetEntryData(row, m_aUserData.back().get()); + } + virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems, bool bKeepExisting) override { freeze(); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 19ad71bfc4b4..862987edfc77 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -4518,6 +4518,29 @@ private: return bRet; } + static void signalToggled(GtkCellRendererToggle* pCell, const gchar *path, gpointer widget) + { + GtkInstanceTreeView* pThis = static_cast<GtkInstanceTreeView*>(widget); + void* pData = g_object_get_data(G_OBJECT(pCell), "g-lo-CellIndex"); + pThis->signal_toggled(path, reinterpret_cast<sal_IntPtr>(pData)); + } + + void signal_toggled(const gchar *path, int nIndex) + { + GtkTreePath *tree_path = gtk_tree_path_new_from_string(path); + + GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore); + GtkTreeIter iter; + gtk_tree_model_get_iter(pModel, &iter, tree_path); + + gboolean bRet(false); + gtk_tree_model_get(pModel, &iter, nIndex, &bRet, -1); + bRet = !bRet; + gtk_tree_store_set(m_pTreeStore, &iter, nIndex, bRet, -1); + + gtk_tree_path_free(tree_path); + } + public: GtkInstanceTreeView(GtkTreeView* pTreeView, bool bTakeOwnership) : GtkInstanceContainer(GTK_CONTAINER(pTreeView), bTakeOwnership) @@ -4543,8 +4566,13 @@ public: GtkCellRenderer* pCellRenderer = GTK_CELL_RENDERER(pRenderer->data); if (m_nTextCol == -1 && GTK_IS_CELL_RENDERER_TEXT(pCellRenderer)) m_nTextCol = nIndex; - else if (m_nToggleCol == -1 && GTK_IS_CELL_RENDERER_TOGGLE(pCellRenderer)) - m_nToggleCol = nIndex; + else if (GTK_IS_CELL_RENDERER_TOGGLE(pCellRenderer)) + { + if (m_nToggleCol == -1) + m_nToggleCol = nIndex; + g_object_set_data(G_OBJECT(pCellRenderer), "g-lo-CellIndex", reinterpret_cast<gpointer>(nIndex)); + g_signal_connect(G_OBJECT(pCellRenderer), "toggled", G_CALLBACK(signalToggled), this); + } else if (GTK_IS_CELL_RENDERER_PIXBUF(pCellRenderer)) { const bool bExpander = g_list_next(pRenderer) != nullptr; @@ -5984,6 +6012,16 @@ private: return sRet; } + void set(int pos, int col, const OUString& rText) + { + GtkTreeIter iter; + if (gtk_tree_model_iter_nth_child(m_pTreeModel, &iter, nullptr, pos)) + { + OString aStr(OUStringToOString(rText, RTL_TEXTENCODING_UTF8)); + gtk_list_store_set(GTK_LIST_STORE(m_pTreeModel), &iter, col, aStr.getStr(), -1); + } + } + int find(const OUString& rStr, int col) const { GtkTreeIter iter; @@ -6301,6 +6339,12 @@ public: return get(pos, id_column); } + virtual void set_id(int pos, const OUString& rId) override + { + gint id_column = gtk_combo_box_get_id_column(m_pComboBox); + set(pos, id_column, rId); + } + // https://gitlab.gnome.org/GNOME/gtk/issues/94 // when a super tall combobox menu is activated, and the selected entry is sufficiently // far down the list, then the menu doesn't appear under wayland |