diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-14 12:52:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-14 18:25:19 +0200 |
commit | 7b8556729629ceaf633f60c86f0114e4427d2b4a (patch) | |
tree | f8182d12df8dabf7c819c2cf0be1bfdfb87a85a5 | |
parent | a9a0601e2af539ab8feed76279181339393ae633 (diff) |
weld GalleryIdDialog
Change-Id: I214afef7668eaf5082683f1c77b08aa0c5107619
Reviewed-on: https://gerrit.libreoffice.org/54317
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | cui/source/dialogs/cuigaldlg.cxx | 47 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 16 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 14 | ||||
-rw-r--r-- | cui/source/inc/cuigaldlg.hxx | 15 | ||||
-rw-r--r-- | cui/uiconfig/ui/gallerythemeiddialog.ui | 72 | ||||
-rw-r--r-- | include/svx/galtheme.hxx | 4 | ||||
-rw-r--r-- | include/svx/svxdlg.hxx | 4 | ||||
-rw-r--r-- | svx/source/gallery2/galbrws1.cxx | 2 | ||||
-rw-r--r-- | svx/source/gallery2/gallery1.cxx | 6 |
9 files changed, 91 insertions, 89 deletions
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index 1e39d5b1055b..6729b7fcd912 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -503,41 +503,29 @@ TitleDialog::~TitleDialog() { } -GalleryIdDialog::GalleryIdDialog( vcl::Window* pParent, GalleryTheme* _pThm ) - : ModalDialog(pParent, "GalleryThemeIDDialog", "cui/ui/gallerythemeiddialog.ui") - , pThm(_pThm ) +GalleryIdDialog::GalleryIdDialog(weld::Window* pParent, GalleryTheme* _pThm) + : GenericDialogController(pParent, "cui/ui/gallerythemeiddialog.ui", "GalleryThemeIDDialog") + , m_pThm(_pThm) + , m_xBtnOk(m_xBuilder->weld_button("ok")) + , m_xLbResName(m_xBuilder->weld_combo_box_text("entry")) { - get(m_pBtnOk, "ok"); - get(m_pLbResName, "entry"); + m_xLbResName->append_text("!!! No Id !!!"); - m_pLbResName->InsertEntry( OUString( "!!! No Id !!!" ) ); + GalleryTheme::InsertAllThemes(*m_xLbResName); - GalleryTheme::InsertAllThemes(*m_pLbResName); + m_xLbResName->set_active(m_pThm->GetId()); + m_xLbResName->grab_focus(); - m_pLbResName->SelectEntryPos( static_cast<sal_uInt16>(pThm->GetId()) ); - m_pLbResName->GrabFocus(); - - m_pBtnOk->SetClickHdl( LINK( this, GalleryIdDialog, ClickOkHdl ) ); + m_xBtnOk->connect_clicked(LINK(this, GalleryIdDialog, ClickOkHdl)); } - GalleryIdDialog::~GalleryIdDialog() { - disposeOnce(); -} - - -void GalleryIdDialog::dispose() -{ - m_pBtnOk.clear(); - m_pLbResName.clear(); - ModalDialog::dispose(); } - -IMPL_LINK_NOARG(GalleryIdDialog, ClickOkHdl, Button*, void) +IMPL_LINK_NOARG(GalleryIdDialog, ClickOkHdl, weld::Button&, void) { - Gallery* pGal = pThm->GetParent(); + Gallery* pGal = m_pThm->GetParent(); const sal_uLong nId = GetId(); bool bDifferentThemeExists = false; @@ -545,26 +533,25 @@ IMPL_LINK_NOARG(GalleryIdDialog, ClickOkHdl, Button*, void) { const GalleryThemeEntry* pInfo = pGal->GetThemeInfo( i ); - if( ( pInfo->GetId() == nId ) && ( pInfo->GetThemeName() != pThm->GetName() ) ) + if ((pInfo->GetId() == nId) && (pInfo->GetThemeName() != m_pThm->GetName())) { OUString aStr( CuiResId( RID_SVXSTR_GALLERY_ID_EXISTS ) ); aStr += " (" + pInfo->GetThemeName() + ")"; - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Info, VclButtonsType::Ok, aStr)); xInfoBox->run(); - m_pLbResName->GrabFocus(); + m_xLbResName->grab_focus(); bDifferentThemeExists = true; } } - if( !bDifferentThemeExists ) - EndDialog( RET_OK ); + if (!bDifferentThemeExists) + m_xDialog->response(RET_OK); } - GalleryThemeProperties::GalleryThemeProperties(vcl::Window* pParent, ExchangeData* _pData, SfxItemSet const * pItemSet) : SfxTabDialog( pParent, "GalleryThemeDialog", diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 283bd1a651d1..a5c76ef405ab 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -117,7 +117,12 @@ short AbstractTitleDialog_Impl::Execute() } IMPL_ABSTDLG_BASE(AbstractScriptSelectorDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractGalleryIdDialog_Impl); + +short AbstractGalleryIdDialog_Impl::Execute() +{ + return m_xDlg->run(); +} + IMPL_ABSTDLG_BASE(AbstractURLDlg_Impl); short AbstractSvxSearchSimilarityDialog_Impl::Execute() @@ -518,7 +523,7 @@ OUString AbstractTitleDialog_Impl::GetTitle() const sal_uInt32 AbstractGalleryIdDialog_Impl::GetId() const { - return pDlg->GetId(); + return m_xDlg->GetId(); } void VclAbstractRefreshableDialog_Impl::Update() @@ -1084,11 +1089,10 @@ VclPtr<AbstractTitleDialog> AbstractDialogFactory_Impl::CreateTitleDialog(weld:: return VclPtr<AbstractTitleDialog_Impl>::Create(new TitleDialog(pParent, rOldText)); } -VclPtr<AbstractGalleryIdDialog> AbstractDialogFactory_Impl::CreateGalleryIdDialog( vcl::Window* pParent, - GalleryTheme* pThm ) +VclPtr<AbstractGalleryIdDialog> AbstractDialogFactory_Impl::CreateGalleryIdDialog(weld::Window* pParent, + GalleryTheme* pThm) { - VclPtrInstance<GalleryIdDialog> pDlg( pParent, pThm); - return VclPtr<AbstractGalleryIdDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractGalleryIdDialog_Impl>::Create(new GalleryIdDialog(pParent, pThm)); } VclPtr<VclAbstractDialog2> AbstractDialogFactory_Impl::CreateGalleryThemePropertiesDialog(vcl::Window* pParent, diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 7d75a69b9d98..3c4e3dac1bb0 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -256,9 +256,15 @@ class AbstractScriptSelectorDialog_Impl : public AbstractScriptSelectorDialog class GalleryIdDialog; class AbstractGalleryIdDialog_Impl : public AbstractGalleryIdDialog { - DECL_ABSTDLG_BASE(AbstractGalleryIdDialog_Impl,GalleryIdDialog) - - virtual sal_uInt32 GetId() const override; +protected: + std::unique_ptr<GalleryIdDialog> m_xDlg; +public: + explicit AbstractGalleryIdDialog_Impl(GalleryIdDialog* p) + : m_xDlg(p) + { + } + virtual short Execute() override; + virtual sal_uInt32 GetId() const override; }; class URLDlg; @@ -674,7 +680,7 @@ public: virtual VclPtr<VclAbstractRefreshableDialog> CreateActualizeProgressDialog( vcl::Window* pParent, GalleryTheme* pThm ) override; virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Window* pParent, const OUString& rOldText) override; - virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog( vcl::Window* pParent, + virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Window* pParent, GalleryTheme* pThm) override; virtual VclPtr<VclAbstractDialog2> CreateGalleryThemePropertiesDialog(vcl::Window* pParent, ExchangeData* pData, diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx index c316fb6b7e95..a2089ed6ee53 100644 --- a/cui/source/inc/cuigaldlg.hxx +++ b/cui/source/inc/cuigaldlg.hxx @@ -178,19 +178,18 @@ public: OUString GetTitle() const { return m_xEdit->get_text(); } }; -class GalleryIdDialog : public ModalDialog +class GalleryIdDialog : public weld::GenericDialogController { private: - VclPtr<OKButton> m_pBtnOk; - VclPtr<ListBox> m_pLbResName; - GalleryTheme* pThm; + GalleryTheme* m_pThm; + std::unique_ptr<weld::Button> m_xBtnOk; + std::unique_ptr<weld::ComboBoxText> m_xLbResName; - DECL_LINK( ClickOkHdl, Button*, void ); + DECL_LINK(ClickOkHdl, weld::Button&, void); public: - GalleryIdDialog( vcl::Window* pParent, GalleryTheme* pThm ); + GalleryIdDialog(weld::Window* pParent, GalleryTheme* pThm); virtual ~GalleryIdDialog() override; - virtual void dispose() override; - sal_uInt32 GetId() const { return m_pLbResName->GetSelectedEntryPos(); } + sal_uInt32 GetId() const { return m_xLbResName->get_active(); } }; class GalleryThemeProperties : public SfxTabDialog diff --git a/cui/uiconfig/ui/gallerythemeiddialog.ui b/cui/uiconfig/ui/gallerythemeiddialog.ui index 2866366c200f..1cda4ce700e3 100644 --- a/cui/uiconfig/ui/gallerythemeiddialog.ui +++ b/cui/uiconfig/ui/gallerythemeiddialog.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="GalleryThemeIDDialog"> @@ -7,26 +7,31 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="gallerythemeiddialog|GalleryThemeIDDialog">Theme ID</property> <property name="resizable">False</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> <property name="orientation">vertical</property> <property name="spacing">12</property> - <child> - <object class="GtkBox" id="box1"> - <property name="visible">True</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="hexpand">True</property> - <property name="spacing">12</property> + <property name="layout_style">end</property> <child> - <object class="GtkLabel" id="label2"> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="gallerythemeiddialog|label2">ID:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">entry</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> <packing> <property name="expand">False</property> @@ -35,10 +40,12 @@ </packing> </child> <child> - <object class="GtkComboBox" id="entry"> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> </object> <packing> <property name="expand">False</property> @@ -50,22 +57,24 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="pack_type">end</property> + <property name="position">1</property> </packing> </child> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="dialog-action_area1"> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="layout_style">end</property> + <property name="valign">start</property> + <property name="hexpand">True</property> + <property name="spacing">12</property> <child> - <object class="GtkButton" id="ok"> - <property name="label">gtk-ok</property> + <object class="GtkLabel" id="label2"> <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> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="gallerythemeiddialog|label2">ID:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">entry</property> </object> <packing> <property name="expand">False</property> @@ -74,12 +83,10 @@ </packing> </child> <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> + <object class="GtkComboBoxText" id="entry"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> </object> <packing> <property name="expand">False</property> @@ -91,8 +98,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">1</property> + <property name="position">0</property> </packing> </child> </object> diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx index 8442f95ca705..d967392fa3f6 100644 --- a/include/svx/galtheme.hxx +++ b/include/svx/galtheme.hxx @@ -25,6 +25,7 @@ #include <tools/debug.hxx> #include <tools/urlobj.hxx> #include <vcl/salctype.hxx> +#include <vcl/weld.hxx> #include <svl/SfxBroadcaster.hxx> #include <svl/lstner.hxx> #include <svtools/transfer.hxx> @@ -56,7 +57,6 @@ typedef ::std::vector< GalleryObject* > GalleryObjectList; class GalleryThemeEntry; class SgaObject; class FmFormModel; -class ListBox; class Gallery; class GalleryProgress; @@ -205,7 +205,7 @@ public: SAL_DLLPRIVATE SvStream& WriteData( SvStream& rOut ) const; SAL_DLLPRIVATE SvStream& ReadData( SvStream& rIn ); - static void InsertAllThemes( ListBox& rListBox ); + static void InsertAllThemes(weld::ComboBoxText& rListBox); // for buffering PreviewBitmaps and strings for object and path SAL_DLLPRIVATE void GetPreviewBitmapExAndStrings(sal_uInt32 nPos, BitmapEx& rBitmapEx, Size& rSize, OUString& rTitle, OUString& rPath) const; diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index a760676020ab..44bc03f37bdc 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -358,8 +358,8 @@ public: GalleryTheme* pThm ) = 0; virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Window* pParent, const OUString& rOldText) = 0; - virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog( vcl::Window* pParent, - GalleryTheme* pThm ) = 0; + virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Window* pParent, + GalleryTheme* pThm) = 0; virtual VclPtr<VclAbstractDialog2> CreateGalleryThemePropertiesDialog(vcl::Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet ) = 0; diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index 89b9af36a852..93d60ae548aa 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -403,7 +403,7 @@ void GalleryBrowser1::ImplExecute(const OString &rIdent) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - ScopedVclPtr<AbstractGalleryIdDialog> aDlg(pFact->CreateGalleryIdDialog( this, pTheme )); + ScopedVclPtr<AbstractGalleryIdDialog> aDlg(pFact->CreateGalleryIdDialog(GetFrameWeld(), pTheme)); DBG_ASSERT(aDlg, "Dialog creation failed!"); if( aDlg->Execute() == RET_OK ) diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index 2284d35479fa..622974c2349d 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -187,13 +187,13 @@ GalleryThemeEntry::GalleryThemeEntry( bool bCreateUniqueURL, aName = rName; } -void GalleryTheme::InsertAllThemes( ListBox& rListBox ) +void GalleryTheme::InsertAllThemes(weld::ComboBoxText& rListBox) { for (size_t i = 0; i < SAL_N_ELEMENTS(aUnlocalized); ++i) - rListBox.InsertEntry(OUString::createFromAscii(aUnlocalized[i].second)); + rListBox.append_text(OUString::createFromAscii(aUnlocalized[i].second)); for (size_t i = 0; i < SAL_N_ELEMENTS(aLocalized); ++i) - rListBox.InsertEntry(SvxResId(aLocalized[i].second)); + rListBox.append_text(SvxResId(aLocalized[i].second)); } INetURLObject GalleryThemeEntry::ImplGetURLIgnoreCase( const INetURLObject& rURL ) |