summaryrefslogtreecommitdiffstats
path: root/cui/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-14 12:52:37 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-14 18:25:19 +0200
commit7b8556729629ceaf633f60c86f0114e4427d2b4a (patch)
treef8182d12df8dabf7c819c2cf0be1bfdfb87a85a5 /cui/source
parentuse optional ScInterpreterContext if possible (diff)
downloadcore-7b8556729629ceaf633f60c86f0114e4427d2b4a.tar.gz
core-7b8556729629ceaf633f60c86f0114e4427d2b4a.zip
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>
Diffstat (limited to 'cui/source')
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx47
-rw-r--r--cui/source/factory/dlgfact.cxx16
-rw-r--r--cui/source/factory/dlgfact.hxx14
-rw-r--r--cui/source/inc/cuigaldlg.hxx15
4 files changed, 44 insertions, 48 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